Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1565878pxb; Fri, 22 Oct 2021 03:33:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz921tusla/x8v/aCESyASN2tFXW74LI/s4KW5gsUAk3yqu44DlAwSP8w/kvRY49gBBYCKS X-Received: by 2002:a50:d8cf:: with SMTP id y15mr16213853edj.66.1634898826784; Fri, 22 Oct 2021 03:33:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634898826; cv=none; d=google.com; s=arc-20160816; b=wy9CBlzP35d3/haR9zwBjw0umYrNRJewFlOb4A6RmQnR/yuBSadEdkUOSfFi3Zv1+t t6TWrGpdW41pf3KEcv0Ztbsbd21Sg0kQxYQE9cKiTJnvxfg5UiPe9R3dkt62jRSEzFez xBt75sDvUsxWWu50i1qTD58W9LeFhMP/3WFtugINatXG1RNKxZ3VhNnHvS/13/IUaSIu KqeZFpunowqyJlAr+3yVknfy926n/y/K4SdMaMZKRu1/kmnEfTpC13tvui4QVvsfkJL3 N6F4gLMur2PtQ432Qp/VGVchG2nICKYkLWFgjHl17Sj+q4+laumc4oQnabJDdZwnPCZe Kohg== 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-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=lFyvqEMOSMsOH4aLvo9NqHc01xj5LSgJ8xc4noWu1Cg=; b=ZoN8acSCs8ss5TkNp+D3EfrPppZilZbx7UtL5DbwDVy6MvZJzicAM2cR5fTcWNLqOi gRyjovZByuo3PHSwztyH/VQ1VLx4vgL8qwwKjePF3Xt4sLLsIziQNDViale7Aewm4TvR OI7byaBN1MP05eAboDLvfLcHMapZh+8pWX7VCIoX6dLCa1X1ZqpKQNX3xgQbgmqJnNCi Xg4bauJrf5LJ03rlCyjgILPV1Gb9ON2tLeSlSZyVMiulu853J0c04bE4NcYYZ7KNkmLY rp6ZNSGfEpgMSoe4fpeDm8MMQ2Ic9P1JG2lVfq27826sTKH8h4bOa7Q7a1rxpAWEie1n GS5g== 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 w20si14210656edd.579.2021.10.22.03.33.22; Fri, 22 Oct 2021 03:33:46 -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 S232613AbhJVKb2 (ORCPT + 99 others); Fri, 22 Oct 2021 06:31:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56722 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232483AbhJVKb1 (ORCPT ); Fri, 22 Oct 2021 06:31:27 -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 CACF6C061766 for ; Fri, 22 Oct 2021 03:29:09 -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 1mdrnH-0005WW-DE; Fri, 22 Oct 2021 12:28:59 +0200 Received: from ore by ptx.hi.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1mdrnG-0000Ns-TT; Fri, 22 Oct 2021 12:28:58 +0200 Date: Fri, 22 Oct 2021 12:28:58 +0200 From: Oleksij Rempel To: Zhang Changzhong Cc: Robin van der Gracht , Oleksij Rempel , kernel@pengutronix.de, Oliver Hartkopp , Marc Kleine-Budde , "David S. Miller" , Jakub Kicinski , linux-can@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net 3/3] can: j1939: j1939_tp_cmd_recv(): check the dst address of TP.CM_BAM Message-ID: <20211022102858.GC20681@pengutronix.de> References: <1634825057-47915-1-git-send-email-zhangchangzhong@huawei.com> <1634825057-47915-4-git-send-email-zhangchangzhong@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1634825057-47915-4-git-send-email-zhangchangzhong@huawei.com> 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: 12:27:34 up 246 days, 13:51, 123 users, load average: 0.16, 0.13, 0.14 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 21, 2021 at 10:04:17PM +0800, Zhang Changzhong wrote: > The TP.CM_BAM message must be sent to the global address [1], so add a > check to drop TP.CM_BAM sent to a non-global address. > > Without this patch, the receiver will treat the following packets as > normal RTS/CTS tranport: > 18EC0102#20090002FF002301 > 18EB0102#0100000000000000 > 18EB0102#020000FFFFFFFFFF > > [1] SAE-J1939-82 2015 A.3.3 Row 1. > > Fixes: 9d71dd0c7009 ("can: add support of SAE J1939 protocol") > Signed-off-by: Zhang Changzhong > --- > net/can/j1939/transport.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/net/can/j1939/transport.c b/net/can/j1939/transport.c > index 2efa606..93ec0c3 100644 > --- a/net/can/j1939/transport.c > +++ b/net/can/j1939/transport.c > @@ -2019,6 +2019,8 @@ static void j1939_tp_cmd_recv(struct j1939_priv *priv, struct sk_buff *skb) > extd = J1939_ETP; > fallthrough; > case J1939_TP_CMD_BAM: > + if (!j1939_cb_is_broadcast(skcb)) Please add here netdev_err_once("with some message"), we need to know if some MCU makes bad things. > + return; > fallthrough; > case J1939_TP_CMD_RTS: > if (skcb->addr.type != extd) > -- > 2.9.5 > > -- 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 |