Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5449355imu; Wed, 19 Dec 2018 11:20:49 -0800 (PST) X-Google-Smtp-Source: AFSGD/Vaq3C1K4x9OwH+mzgj+doYUW01y/9Gflvv7EmcYX6KoZt1gdR2DpLfEhqWccDcgcBPsY6/ X-Received: by 2002:a62:190e:: with SMTP id 14mr21520850pfz.70.1545247249656; Wed, 19 Dec 2018 11:20:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545247249; cv=none; d=google.com; s=arc-20160816; b=NlfQaK1iZ/E1f1kdjrdAwM0WLWwR2jSp+QYj0+HkT1FDSH0yWC/GKQPhxm5OZ3pXq8 4loVRyhegPEV3P6Zu7hPqN1ge2lBFamQaJ0n3jHZa/635NnNe6EP3ztOCXrxxPe7TjKu aH9C2iBOXS3HJ+4JEipp0V52Nhzspnf5qGfpLkFt2Lka/FD20Y1BhkeP/Yt9JfNdtpMu 6IFCKYtWsU3Tl9Brf8GpzPRy8qG051sBgF8CVFFW6I0XpLfk14iJ3kUC1ty1WCfZyVa9 THyaceWi7MBSmMUO6iPmDAyr944OXeAbI6ihyh3z7YAFHIA8qn0RbRtcHF1093k6B9R0 PDqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:date:message-id :cc:to:subject:from; bh=Lqacs5GtBDtlf7OpHxASfljBFdIqzY/96B0wonQEReM=; b=cX1OuhEZzW174scHLe/LkAC38yNeKy6EryUPr7IOUKYXtDsCdjOabuU0wm05B+OyYR ALPVhzfc/Dss+ZnKYqAABWOysyqUR4Hw1GMBYGFcuKfocFkaUJbOfIAlaPTLHcercwXU xT2K9MRf4X+4hVOsw99Ye8KPKUY+BIWpexILPU7q6KJHcQZ7VGNHR0e45DKudrQRfPG5 aSmMVG7KO4I9uGfh44DWKK4EJv8tqv3yYBgUHmXVRDKmkWhp6m/V4DEzE6GD+jesm84X jL+fRyt0eixASRgyw5a3f91IXVULIQx9U0p8Bn55FHmKNv3Nu734MnZtNa70kzKR52vp YbUg== 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 c12si13473100pgb.402.2018.12.19.11.20.34; Wed, 19 Dec 2018 11:20:49 -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 S1729554AbeLSSqD (ORCPT + 99 others); Wed, 19 Dec 2018 13:46:03 -0500 Received: from mx-ginzinger.sigmacloud.services ([185.154.235.147]:43762 "EHLO mx-ginzinger.sigmacloud.services" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727494AbeLSSqC (ORCPT ); Wed, 19 Dec 2018 13:46:02 -0500 X-Greylist: delayed 345 seconds by postgrey-1.27 at vger.kernel.org; Wed, 19 Dec 2018 13:46:01 EST Received: from [31.193.165.228] (port=29147 helo=mx-ginzinger.sigmacloud.services) by mx-ginzinger.sigmacloud.services with esmtps (TLSv1.2:AES256-GCM-SHA384:256) (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1gZglD-0001fd-2e; Wed, 19 Dec 2018 19:39:59 +0100 Received: from [10.10.1.106] (10.10.1.106) by exc1.buero.ginzinger.com (10.1.1.204) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1466.3; Wed, 19 Dec 2018 19:39:59 +0100 X-CTCH-RefID: str=0001.0A0B0212.5C1A907F.006D:SCFSTAT16437741,ss=1,re=-4.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0 From: Manfred Schlaegl Subject: [PATCH] Revert "can: dev: __can_get_echo_skb(): print error message, if trying to echo non existing skb" To: Wolfgang Grandegger , Marc Kleine-Budde , "David S. Miller" CC: , , Message-ID: Date: Wed, 19 Dec 2018 19:39:58 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0 X-Originating-IP: [10.10.1.106] X-ClientProxiedBy: exc1.buero.ginzinger.com (10.1.1.204) To exc1.buero.ginzinger.com (10.1.1.204) X-EXCLAIMER-MD-ORIGINAL-SUBJECT: [PATCH] Revert "can: dev: __can_get_echo_skb(): print error message, if trying to echo non existing skb"[NOSIG][NODISC] X-EXCLAIMER-MD-CONFIG: 9dd172f7-de2e-4231-b886-ec11f46e03b3 MIME-Version: 1.0 Content-Type: multipart/signed; protocol="application/x-pkcs7-signature"; micalg="sha-256"; boundary="----A5E473DAD6402B9E89BD65D5D8686D6A" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is an S/MIME signed message ------A5E473DAD6402B9E89BD65D5D8686D6A MIME-Version: 1.0 Content-Type: text/plain; charset="windows-1252" Content-Language: de-AT Content-Transfer-Encoding: 7bit This reverts commit 7da11ba5c5066dadc2e96835a6233d56d7b7764a. After introduction of this change we encountered following new error message on various i.MX plattforms (flexcan) flexcan 53fc8000.can can0: __can_get_echo_skb: BUG! Trying to echo non existing skb: can_priv::echo_skb[0] The introduction of the message was a mistake because priv->echo_skb[idx] = NULL is a perfectly valid in following case: If CAN_RAW_LOOPBACK is disabled (setsockopt) in applications, the pkt_type of the tx skb's given to can_put_echo_skb is set to PACKET_LOOPBACK. In this case can_put_echo_skb will not set priv->echo_skb[idx]. It is therefore kept NULL. (As additional argument for revert: The order of check and usage of idx was changed. idx is used to access an array element before checking it's boundaries) Signed-off-by: Manfred Schlaegl --- drivers/net/can/dev.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c index 3b3f88ffab53..c05e4d50d43d 100644 --- a/drivers/net/can/dev.c +++ b/drivers/net/can/dev.c @@ -480,8 +480,6 @@ EXPORT_SYMBOL_GPL(can_put_echo_skb); struct sk_buff *__can_get_echo_skb(struct net_device *dev, unsigned int idx, u8 *len_ptr) { struct can_priv *priv = netdev_priv(dev); - struct sk_buff *skb = priv->echo_skb[idx]; - struct canfd_frame *cf; if (idx >= priv->echo_skb_max) { netdev_err(dev, "%s: BUG! Trying to access can_priv::echo_skb out of bounds (%u/max %u)\n", @@ -489,20 +487,21 @@ struct sk_buff *__can_get_echo_skb(struct net_device *dev, unsigned int idx, u8 return NULL; } - if (!skb) { - netdev_err(dev, "%s: BUG! Trying to echo non existing skb: can_priv::echo_skb[%u]\n", - __func__, idx); - return NULL; - } + if (priv->echo_skb[idx]) { + /* Using "struct canfd_frame::len" for the frame + * length is supported on both CAN and CANFD frames. + */ + struct sk_buff *skb = priv->echo_skb[idx]; + struct canfd_frame *cf = (struct canfd_frame *)skb->data; + u8 len = cf->len; - /* Using "struct canfd_frame::len" for the frame - * length is supported on both CAN and CANFD frames. - */ - cf = (struct canfd_frame *)skb->data; - *len_ptr = cf->len; - priv->echo_skb[idx] = NULL; + *len_ptr = len; + priv->echo_skb[idx] = NULL; - return skb; + return skb; + } + + return NULL; } /* -- 2.11.0 ------A5E473DAD6402B9E89BD65D5D8686D6A Content-Type: application/x-pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="smime.p7s" MIIOGgYJKoZIhvcNAQcCoIIOCzCCDgcCAQExDzANBglghkgBZQMEAgEFADALBgkq hkiG9w0BBwGgggsfMIIF5jCCA86gAwIBAgIQapvhODv/K2ufAdXZuKdSVjANBgkq hkiG9w0BAQwFADCBhTELMAkGA1UEBhMCR0IxGzAZBgN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