[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <lsq.1519831222.221203413@decadent.org.uk>
Date: Wed, 28 Feb 2018 15:20:22 +0000
From: Ben Hutchings <ben@...adent.org.uk>
To: linux-kernel@...r.kernel.org, stable@...r.kernel.org
CC: akpm@...ux-foundation.org,
"Oliver Hartkopp" <socketcan@...tkopp.net>,
"Marc Kleine-Budde" <mkl@...gutronix.de>,
"Dmitry Vyukov" <dvyukov@...gle.com>,
syzbot+4386709c0c1284dca827@...kaller.appspotmail.com
Subject: [PATCH 3.2 110/140] can: af_can: can_rcv(): replace WARN_ONCE by
pr_warn_once
3.2.100-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Marc Kleine-Budde <mkl@...gutronix.de>
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@...kaller.appspotmail.com
Suggested-by: Dmitry Vyukov <dvyukov@...gle.com>
Acked-by: Oliver Hartkopp <socketcan@...tkopp.net>
Signed-off-by: Marc Kleine-Budde <mkl@...gutronix.de>
[bwh: Backported to 3.2:
- Keep using the 'drop' label, as it has another user
- Adjust context]
Signed-off-by: Ben Hutchings <ben@...adent.org.uk>
---
--- a/net/can/af_can.c
+++ b/net/can/af_can.c
@@ -653,13 +653,13 @@ static int can_rcv(struct sk_buff *skb,
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++;
Powered by blists - more mailing lists