* [PATCH 1/2] [stable pre-4.12] can: af_can: can_rcv(): replace WARN_ONCE by pr_warn_once
@ 2018-01-22 13:44 Oliver Hartkopp
2018-01-22 13:44 ` [PATCH 2/2] [stable pre-4.12] can: af_can: canfd_rcv(): " Oliver Hartkopp
0 siblings, 1 reply; 3+ messages in thread
From: Oliver Hartkopp @ 2018-01-22 13:44 UTC (permalink / raw)
To: stable, gregkh; +Cc: Oliver Hartkopp, linux-stable, Marc Kleine-Budde
In Linux 4.12 commit 8e8cda6d737d356054c ("can: initial support for network
namespaces") removed a namespace check which affected this patch:
upstream commit 8cb68751c115d176ec851ca56ecfbb411568c9e8
can: af_can: can_rcv(): replace WARN_ONCE by pr_warn_once
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>
Cc: linux-stable <stable@vger.kernel.org> [pre 4.12]
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
---
net/can/af_can.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/net/can/af_can.c b/net/can/af_can.c
index 928f58064098..924ad0513af9 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;
--
2.15.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] [stable pre-4.12] can: af_can: canfd_rcv(): replace WARN_ONCE by pr_warn_once
2018-01-22 13:44 [PATCH 1/2] [stable pre-4.12] can: af_can: can_rcv(): replace WARN_ONCE by pr_warn_once Oliver Hartkopp
@ 2018-01-22 13:44 ` Oliver Hartkopp
2018-01-24 9:38 ` Greg KH
0 siblings, 1 reply; 3+ messages in thread
From: Oliver Hartkopp @ 2018-01-22 13:44 UTC (permalink / raw)
To: stable, gregkh; +Cc: Oliver Hartkopp, linux-stable, Marc Kleine-Budde
In Linux 4.12 commit 8e8cda6d737d356054c ("can: initial support for network
namespaces") removed a namespace check which affected this patch:
can: af_can: canfd_rcv(): replace WARN_ONCE by pr_warn_once
upstream commit d4689846881d160a4d12a514e991a740bcb5d65a
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> [pre 4.12]
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
---
net/can/af_can.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/net/can/af_can.c b/net/can/af_can.c
index 924ad0513af9..c866e761651a 100644
--- a/net/can/af_can.c
+++ b/net/can/af_can.c
@@ -745,13 +745,12 @@ static int canfd_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 != 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))
+ 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);
goto drop;
+ }
can_receive(skb, dev);
return NET_RX_SUCCESS;
--
2.15.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 2/2] [stable pre-4.12] can: af_can: canfd_rcv(): replace WARN_ONCE by pr_warn_once
2018-01-22 13:44 ` [PATCH 2/2] [stable pre-4.12] can: af_can: canfd_rcv(): " Oliver Hartkopp
@ 2018-01-24 9:38 ` Greg KH
0 siblings, 0 replies; 3+ messages in thread
From: Greg KH @ 2018-01-24 9:38 UTC (permalink / raw)
To: Oliver Hartkopp; +Cc: stable, linux-stable, Marc Kleine-Budde
On Mon, Jan 22, 2018 at 02:44:47PM +0100, Oliver Hartkopp wrote:
> In Linux 4.12 commit 8e8cda6d737d356054c ("can: initial support for network
> namespaces") removed a namespace check which affected this patch:
Thanks for the two backports, now queued up.
greg k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-01-24 9:38 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-22 13:44 [PATCH 1/2] [stable pre-4.12] can: af_can: can_rcv(): replace WARN_ONCE by pr_warn_once Oliver Hartkopp
2018-01-22 13:44 ` [PATCH 2/2] [stable pre-4.12] can: af_can: canfd_rcv(): " Oliver Hartkopp
2018-01-24 9:38 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).