diff options
author | Marc Kleine-Budde <mkl@pengutronix.de> | 2018-01-16 19:30:14 +0100 |
---|---|---|
committer | Ben Hutchings <ben@decadent.org.uk> | 2018-03-03 15:51:01 +0000 |
commit | e9dcb12d53e6dbf31574e881cf5d3076dd76432b (patch) | |
tree | f6e51f2d581f6287049cbc09258d343eeac9aa77 | |
parent | 35189a2e2d729caa1e5a74330e18280bc896fada (diff) |
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>
[bwh: Backported to 3.2:
- Keep using the 'drop' label, as it has another user
- Adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
-rw-r--r-- | net/can/af_can.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/net/can/af_can.c b/net/can/af_can.c index 3ddc74960959..57c43649a715 100644 --- a/net/can/af_can.c +++ b/net/can/af_can.c @@ -653,13 +653,13 @@ static int can_rcv(struct sk_buff *skb, struct net_device *dev, if (!net_eq(dev_net(dev), &init_net)) goto drop; - if (WARN_ONCE(dev->type != ARPHRD_CAN || - skb->len != sizeof(struct can_frame) || - cf->can_dlc > 8, - "PF_CAN: dropped non conform skbuf: " - "dev type %d, len %d, can_dlc %d\n", - dev->type, skb->len, cf->can_dlc)) + if (unlikely(dev->type != ARPHRD_CAN || + skb->len != sizeof(struct can_frame) || + cf->can_dlc > 8)) { + pr_warn_once("PF_CAN: dropped non conform CAN skbuf: dev type %d, len %d, can_dlc %d\n", + dev->type, skb->len, cf->can_dlc); goto drop; + } /* update statistics */ can_stats.rx_frames++; |