From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-sn1nam02on0091.outbound.protection.outlook.com ([104.47.36.91]:53152 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1032057AbeCAPag (ORCPT ); Thu, 1 Mar 2018 10:30:36 -0500 From: Sasha Levin To: "stable@vger.kernel.org" , "stable-commits@vger.kernel.org" CC: Marc Kleine-Budde , Sasha Levin Subject: [added to the 4.1 stable tree] can: af_can: can_rcv(): replace WARN_ONCE by pr_warn_once Date: Thu, 1 Mar 2018 15:24:37 +0000 Message-ID: <20180301152116.1486-206-alexander.levin@microsoft.com> References: <20180301152116.1486-1-alexander.levin@microsoft.com> In-Reply-To: <20180301152116.1486-1-alexander.levin@microsoft.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: Marc Kleine-Budde This patch has been added to the 4.1 stable tree. If you have any objections, please let us know. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D [ Upstream commit 8cb68751c115d176ec851ca56ecfbb411568c9e8 ] 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 Acked-by: Oliver Hartkopp Cc: linux-stable Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin --- 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 62c635f2bcfc..05336748579c 100644 --- a/net/can/af_can.c +++ b/net/can/af_can.c @@ -714,13 +714,12 @@ static int can_rcv(struct sk_buff *skb, struct net_de= vice *dev, if (unlikely(!net_eq(dev_net(dev), &init_net))) goto drop; =20 - if (WARN_ONCE(dev->type !=3D ARPHRD_CAN || - skb->len !=3D 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 !=3D ARPHRD_CAN || skb->len !=3D 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; + } =20 can_receive(skb, dev); return NET_RX_SUCCESS; --=20 2.14.1