Received: by 10.223.185.116 with SMTP id b49csp6373892wrg; Wed, 28 Feb 2018 08:21:44 -0800 (PST) X-Google-Smtp-Source: AH8x224Ci3bItmGLnLWP53zk4u/XxnAMQwOoEDShaJNgt5PcJnt7rntJwokSLFPuQ6U2fj8b+HBO X-Received: by 10.99.125.19 with SMTP id y19mr14314959pgc.285.1519834904344; Wed, 28 Feb 2018 08:21:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519834904; cv=none; d=google.com; s=arc-20160816; b=inHP79bR4ui+V5C5QHpcohi1b+N5JDvJaEz1fub2eaLLlfNIwWROIh/LZcFCDPvEHE x4MFo3/Qob1/D6lCQKTtqC2VydslPzEIdQDHAHvliWVaFznz+4GrvawGDSa+dwBFPZrS ucFFs3jtB7oK4ca2yARO3H+TYgJ06QT0uVJ1oveIQRU6FMU0AYD8ZHjaOBduMzrmwgt1 PNsnL+vDqEMg5NnAceIomfNVxD5cyFFmD0eZmWlWgS9zSnfKXtXa5x0xSM31Lc9yDHCQ ybCy2CV2JuUSwRur0NYKznbTssrT5c7ljQnMPhoWN9lshGp0qBHZzZiKc9TNstWlhqCU SloA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition :arc-authentication-results; bh=hJahpn7VZT+T/cjpJtrR7+AtCYs5aCrH/fP5s4gww18=; b=Z2FS+XJ+fdlTuyFKjrrZB4dJ0/CmOEAzf+/VYoPsggxIZ2Z/EXz873INSVxj5mDSws VLFGwvoLdmKjXj8VxQVD7iUZzoELNlXpSaOo/qUsHJ2KMhcOrlupFtQiVLkR3OYrwhQ9 FPlhL/fqyCY9YPM7pxHZk3GqDR5QDBMf2wy8ExWXYLdJSlgTq3nbHlBI/hAfXfSyukKb KcDfTKTf7yKcUYg9G3cwXutwlJo43ZKZ9Q6VSUTEoFezD3hmosDvxh0DAexjhZezE1CH OxP8kKyNcqK+yemgWvgq5kmsW5rAqWFNjbOz/u7ezp8bAQ/AK/cxhjzQvRqJ3JoeyJuP Pqmw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z96-v6si1511421plh.35.2018.02.28.08.21.30; Wed, 28 Feb 2018 08:21:44 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934948AbeB1QUB (ORCPT + 99 others); Wed, 28 Feb 2018 11:20:01 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:35221 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932732AbeB1QQI (ORCPT ); Wed, 28 Feb 2018 11:16:08 -0500 Received: from [2a02:8011:400e:2:6f00:88c8:c921:d332] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1er3Yo-0006XR-93; Wed, 28 Feb 2018 15:22:26 +0000 Received: from ben by deadeye with local (Exim 4.90_1) (envelope-from ) id 1er3Yk-0000HY-9O; Wed, 28 Feb 2018 15:22:22 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Dmitry Vyukov" , "Oliver Hartkopp" , "Marc Kleine-Budde" , syzbot+4386709c0c1284dca827@syzkaller.appspotmail.com Date: Wed, 28 Feb 2018 15:20:18 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 219/254] can: af_can: can_rcv(): replace WARN_ONCE by pr_warn_once In-Reply-To: X-SA-Exim-Connect-IP: 2a02:8011:400e:2:6f00:88c8:c921:d332 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.55-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Marc Kleine-Budde 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 Acked-by: Oliver Hartkopp Signed-off-by: Marc Kleine-Budde [bwh: Backported to 3.16: - Keep using the 'drop' label, as it has another user - Adjust context] Signed-off-by: Ben Hutchings --- --- a/net/can/af_can.c +++ b/net/can/af_can.c @@ -719,13 +719,12 @@ static int can_rcv(struct sk_buff *skb, 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;