Skip to content

Commit

Permalink
s390/qeth: make af_iucv TX notification call more robust
Browse files Browse the repository at this point in the history
[ Upstream commit 34c7f50 ]

Calling into socket code is ugly already, at least check whether we are
dealing with the expected sk_family. Only looking at skb->protocol is
bound to cause troubles (consider eg. af_packet).

Fixes: b333293 ("qeth: add support for af_iucv HiperSockets transport")
Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
julianwiedmann authored and gregkh committed Dec 2, 2020
1 parent 9ad73b2 commit 35eafcf
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/s390/net/qeth_core_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

#include <net/iucv/af_iucv.h>
#include <net/dsfield.h>
#include <net/sock.h>

#include <asm/ebcdic.h>
#include <asm/chpid.h>
Expand Down Expand Up @@ -1408,7 +1409,7 @@ static void qeth_notify_skbs(struct qeth_qdio_out_q *q,
skb_queue_walk(&buf->skb_list, skb) {
QETH_CARD_TEXT_(q->card, 5, "skbn%d", notification);
QETH_CARD_TEXT_(q->card, 5, "%lx", (long) skb);
if (skb->protocol == htons(ETH_P_AF_IUCV) && skb->sk)
if (skb->sk && skb->sk->sk_family == PF_IUCV)
iucv_sk(skb->sk)->sk_txnotify(skb, notification);
}
}
Expand Down

0 comments on commit 35eafcf

Please sign in to comment.