Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1330735pxb; Thu, 28 Oct 2021 01:33:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwxAFRGKX+NOyYB12UCbaEPvfL0SzWRRBRDqdySAbujRiYBJiWRiyJQrM2pz94VcDu3nrQa X-Received: by 2002:a63:84c6:: with SMTP id k189mr2126328pgd.245.1635410002718; Thu, 28 Oct 2021 01:33:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635410002; cv=none; d=google.com; s=arc-20160816; b=Hm8IZpyZj2Tp37hP9sXpTQNoIdmr9kMAPoILYjVpoWJHF1c1vcpOqC+qXuLWD79H/G 1gy08Acd17qpkd1vxl087F3stTiHYMHsqwbqgVZ6mdll8uGYSrbR7ZRfh4/cAtt3e0Cq HD0Ocg33QB+WVtGD1dhW15gNTQhJGgo2HnOQVQZ3hV2ZKPqJ8/DplgWoka2TgMZyUx3y sMM0wdx+auigA+mEdhwucHzh6+uMzpQ7NmLpr/aLFYZvamPGAGdeIEltmWDEMXH+VkpC nxnsJo2ffBeFAYQ4jtA+kyxbaXKpSgMNs1SCGddTQh69LDwda7vUkX9MVNgGXp8vu/w7 Ofdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=vOmi0tL+1TWTmQZWGG9k9sDs28VGGtuc+bMsLWe/0MQ=; b=uZRM7Go0K6WICoJBWUZJqry8w0x9Hlu1ka7NyLX09qAziplZdF2N0SmtX49+OCFu/4 OR568v+dzhvspqOIK2llvXVC0spin1iOW7A7g0hCFL1LSN0IrtwBfJMgTWfXcLJ5YAvj zRmHNrnHKZ84/eYWzOpIYdEIR2ga2dKa2+9ut+7eIS2kczyooHVHl6LgWOHyp4WPPx6e iQrlo10UD11w9qZqNj740/Y0btQQVdJXDsq1IcOLhYbTieFNbCmmpJMGGGXJ62sjbIUs ySG22gQoCFHEWuCgzuip7oBmbuLIu3HzAkN/OFttZbXJ7bj+/q1k0RBkW8aqaM7Ta7rb EW4g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b7si2777311plh.437.2021.10.28.01.33.09; Thu, 28 Oct 2021 01:33:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230060AbhJ1IdY (ORCPT + 99 others); Thu, 28 Oct 2021 04:33:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229791AbhJ1IdX (ORCPT ); Thu, 28 Oct 2021 04:33:23 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 635CAC061570 for ; Thu, 28 Oct 2021 01:30:57 -0700 (PDT) Received: from ptx.hi.pengutronix.de ([2001:67c:670:100:1d::c0]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mg0oB-00045G-SJ; Thu, 28 Oct 2021 10:30:47 +0200 Received: from ore by ptx.hi.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1mg0oA-0007Qs-Fn; Thu, 28 Oct 2021 10:30:46 +0200 Date: Thu, 28 Oct 2021 10:30:46 +0200 From: Oleksij Rempel To: Zhang Changzhong Cc: Robin van der Gracht , linux-kernel@vger.kernel.org, Oleksij Rempel , netdev@vger.kernel.org, Marc Kleine-Budde , kernel@pengutronix.de, Oliver Hartkopp , Jakub Kicinski , linux-can@vger.kernel.org, "David S. Miller" Subject: Re: [PATCH net 2/3] can: j1939: j1939_can_recv(): ignore messages with invalid source address Message-ID: <20211028083046.GF20681@pengutronix.de> References: <1634825057-47915-1-git-send-email-zhangchangzhong@huawei.com> <1634825057-47915-3-git-send-email-zhangchangzhong@huawei.com> <20211022102306.GB20681@pengutronix.de> <9c636d7f-70df-18c9-66ed-46eb21f4ffbb@huawei.com> <20211028065144.GE20681@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-IRC: #ptxdist @freenode X-Accept-Language: de,en X-Accept-Content-Type: text/plain X-Uptime: 10:29:58 up 252 days, 11:53, 140 users, load average: 0.15, 0.51, 0.43 User-Agent: Mutt/1.10.1 (2018-07-13) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c0 X-SA-Exim-Mail-From: ore@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 28, 2021 at 03:33:21PM +0800, Zhang Changzhong wrote: > On 2021/10/28 14:51, Oleksij Rempel wrote: > > Hi, > > > > On Mon, Oct 25, 2021 at 03:30:57PM +0800, Zhang Changzhong wrote: > >> On 2021/10/22 18:23, Oleksij Rempel wrote: > >>> On Thu, Oct 21, 2021 at 10:04:16PM +0800, Zhang Changzhong wrote: > >>>> According to SAE-J1939-82 2015 (A.3.6 Row 2), a receiver should never > >>>> send TP.CM_CTS to the global address, so we can add a check in > >>>> j1939_can_recv() to drop messages with invalid source address. > >>>> > >>>> Fixes: 9d71dd0c7009 ("can: add support of SAE J1939 protocol") > >>>> Signed-off-by: Zhang Changzhong > >>> > >>> NACK. This will break Address Claiming, where first message is SA == 0xff > >> > >> I know that 0xfe can be used as a source address, but which message has a source > >> address of 0xff? > >> > >> According to SAE-J1939-81 2017 4.2.2.8: > >> > >> The network address 255, also known as the Global address, is permitted in the > >> Destination Address field of the SAE J1939 message identifier but never in the > >> Source Address field. > > > > You are right. Thx! > > > > Are you using any testing frameworks? > > Can you please take a look here: > > https://github.com/linux-can/can-tests/tree/master/j1939 > > > > We are using this scripts for regression testing of some know bugs. > > Great! I'll run these scripts before posting patches. You are welcome to extend this tests :) Regards, Oleksij -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |