summaryrefslogtreecommitdiffstats
path: root/net/can
diff options
context:
space:
mode:
authorMarc Kleine-Budde <mkl@pengutronix.de>2018-01-16 19:30:14 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-01-31 12:55:50 +0100
commit40bf2c0c1c9ec9c3a17afac43fcd18b39759defd (patch)
treea91de1e6d13d396601464c796d3488885d68ae63 /net/can
parent69e78e7214e39c084fcafdfb83b4d13d21b0008b (diff)
downloadlinux-stable-40bf2c0c1c9ec9c3a17afac43fcd18b39759defd.tar.gz
linux-stable-40bf2c0c1c9ec9c3a17afac43fcd18b39759defd.tar.bz2
linux-stable-40bf2c0c1c9ec9c3a17afac43fcd18b39759defd.zip
can: af_can: can_rcv(): replace WARN_ONCE by pr_warn_once
commit 8cb68751c115d176ec851ca56ecfbb411568c9e8 upstream. If an invalid CAN 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+4386709c0c1284dca827@syzkaller.appspotmail.com Suggested-by: Dmitry Vyukov <dvyukov@google.com> Acked-by: Oliver Hartkopp <socketcan@hartkopp.net> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net/can')
-rw-r--r--net/can/af_can.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/net/can/af_can.c b/net/can/af_can.c
index 5488e4a6ccd0..6ff7df79e006 100644
--- a/net/can/af_can.c
+++ b/net/can/af_can.c
@@ -722,13 +722,12 @@ static int can_rcv(struct sk_buff *skb, struct net_device *dev,
if (unlikely(!net_eq(dev_net(dev), &init_net)))
goto drop;
- if (WARN_ONCE(dev->type != ARPHRD_CAN ||
- skb->len != CAN_MTU ||
- cfd->len > CAN_MAX_DLEN,
- "PF_CAN: dropped non conform CAN skbuf: "
- "dev type %d, len %d, datalen %d\n",
- dev->type, skb->len, cfd->len))
+ if (unlikely(dev->type != ARPHRD_CAN || skb->len != CAN_MTU ||
+ cfd->len > CAN_MAX_DLEN)) {
+ pr_warn_once("PF_CAN: dropped non conform CAN skbuf: dev type %d, len %d, datalen %d\n",
+ dev->type, skb->len, cfd->len);
goto drop;
+ }
can_receive(skb, dev);
return NET_RX_SUCCESS;