diff options
author | Marc Kleine-Budde <mkl@pengutronix.de> | 2018-01-16 19:30:14 +0100 |
---|---|---|
committer | Marc Kleine-Budde <mkl@pengutronix.de> | 2018-01-18 09:32:54 +0100 |
commit | d4689846881d160a4d12a514e991a740bcb5d65a (patch) | |
tree | 14c1023417a3bd20db16427b43e9dd684be0cb97 /net/can/af_can.c | |
parent | 8cb68751c115d176ec851ca56ecfbb411568c9e8 (diff) | |
download | linux-stable-d4689846881d160a4d12a514e991a740bcb5d65a.tar.gz linux-stable-d4689846881d160a4d12a514e991a740bcb5d65a.tar.bz2 linux-stable-d4689846881d160a4d12a514e991a740bcb5d65a.zip |
can: af_can: canfd_rcv(): replace WARN_ONCE by pr_warn_once
If an invalid CANFD frame is received, from a driver or from a tun
interface, a Kernel warning is generated.
This patch replaces the WARN_ONCE by a simple pr_warn_once, so that a
kernel, bootet with panic_on_warn, does not panic. A printk seems to be
more appropriate here.
Reported-by: syzbot+e3b775f40babeff6e68b@syzkaller.appspotmail.com
Suggested-by: Dmitry Vyukov <dvyukov@google.com>
Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>
Cc: linux-stable <stable@vger.kernel.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'net/can/af_can.c')
-rw-r--r-- | net/can/af_can.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/net/can/af_can.c b/net/can/af_can.c index ae835382e678..4d7f988a3130 100644 --- a/net/can/af_can.c +++ b/net/can/af_can.c @@ -738,20 +738,16 @@ static int canfd_rcv(struct sk_buff *skb, struct net_device *dev, { struct canfd_frame *cfd = (struct canfd_frame *)skb->data; - if (WARN_ONCE(dev->type != ARPHRD_CAN || - skb->len != CANFD_MTU || - cfd->len > CANFD_MAX_DLEN, - "PF_CAN: dropped non conform CAN FD skbuf: " - "dev type %d, len %d, datalen %d\n", - dev->type, skb->len, cfd->len)) - goto drop; + if (unlikely(dev->type != ARPHRD_CAN || skb->len != CANFD_MTU || + cfd->len > CANFD_MAX_DLEN)) { + pr_warn_once("PF_CAN: dropped non conform CAN FD skbuf: dev type %d, len %d, datalen %d\n", + dev->type, skb->len, cfd->len); + kfree_skb(skb); + return NET_RX_DROP; + } can_receive(skb, dev); return NET_RX_SUCCESS; - -drop: - kfree_skb(skb); - return NET_RX_DROP; } /* |