Received: by 10.223.185.116 with SMTP id b49csp6338417wrg; Wed, 28 Feb 2018 07:49:28 -0800 (PST) X-Google-Smtp-Source: AG47ELvMxH+8bBsw+xbhY4ToUFphayfLVHBx+3advOk0bbAXB6uPmNraLAf4yQ4bgHxmKr4IcIxn X-Received: by 10.98.131.4 with SMTP id h4mr8415311pfe.156.1519832968216; Wed, 28 Feb 2018 07:49:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519832968; cv=none; d=google.com; s=arc-20160816; b=K4RUndOZwom2utLddi3B7sIGJUbkuoTa948SBJOmp57+WZAwclFDJ9rs/Q07eXtg7q oYCch3wVqm1PCtKrAAZkYGt2PUDAha0I4wHKurH57c7VcDY1Z+UF8AbHRwHmN9hKTOqg qXtWrRSkVuwKobf7FiS+lvN25rS6fk0sL/Sllc+hEIWbmDiKhawc1r2CW2sY6cK2aMfq eDWkdsloimZKr4UmjhGzi62FXysCJe4lSF3BGz+4JR+Wexv2aeCRfIO89PLIJ+nmRH7m 0MhOUm1Fn0gd8u9EeG5TrmLtYa4eftVRJzRXuIi21iX/68VrkbaEWiKD91IVvtXN2D7z oHvg== 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=8uHDYMBatQT0G2pId4nLXxq9dVt6udFke7nwy+5x/q0=; b=vH+JUSHmmJDimivQXD4MFN83D/UMvSBVDvlr4IMALcuVSKJi31U1ImPl+/h5UAJ7NU XzOk+rsmvJh+cvt+jBgn9AbbkDoKvM/RpxdDYSs9DgobjXIk1RM1JkAzGqoo4y8bSKaJ cs/QSLH99UeYeOcMzarmOGKXzfnwfcpJe+jayK2io6P2Ks0ZUGsLwKzcb05e8FCA4Lv2 rG9zRoxTmumW7u3ROptBZiJKzYkg2UovYNXfLp9WJpK3ohmd6Z4o+GdBuax2uRhRq5S5 C0Gr6UqDzrGNKQXWZNlCHR9fIagQkWHfpraaCgEgQEBZJeoa4VpLnYHCAGQ4lVAAxFN+ jMIg== 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 d5si1163900pgf.616.2018.02.28.07.49.13; Wed, 28 Feb 2018 07:49:28 -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 S933503AbeB1PsD (ORCPT + 99 others); Wed, 28 Feb 2018 10:48:03 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:34226 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933490AbeB1Pr7 (ORCPT ); Wed, 28 Feb 2018 10:47:59 -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-0006XS-8m; Wed, 28 Feb 2018 15:22:26 +0000 Received: from ben by deadeye with local (Exim 4.90_1) (envelope-from ) id 1er3Yk-0000Hd-AD; 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, "Marc Kleine-Budde" , syzbot+e3b775f40babeff6e68b@syzkaller.appspotmail.com, "Dmitry Vyukov" , "Oliver Hartkopp" Date: Wed, 28 Feb 2018 15:20:18 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 220/254] can: af_can: canfd_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 d4689846881d160a4d12a514e991a740bcb5d65a upstream. 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 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 @@ -742,13 +742,12 @@ static int canfd_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 != 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;