Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp648902pxb; Thu, 21 Oct 2021 06:56:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwX8RFfYEUswGTEm1tvB4ldkUMoQFfrhcWZqbGkw5sFbM1ldX5fAehxeGPWB/FnozIQGb1G X-Received: by 2002:a50:bf08:: with SMTP id f8mr7616738edk.400.1634824607984; Thu, 21 Oct 2021 06:56:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634824607; cv=none; d=google.com; s=arc-20160816; b=RyDJzwREJhnLfniNrLbG01guqwGh431MWW4Cp+eJNJtd2pdqVaTL93Vxc1gC7GEXL5 HmPZmDGj9pkNRJyuU1opomA3mvG7vIzaYT86QvYUzuxAo4LMz0+7OYSGLgyQHMvUvKDU aJ03CrC8nuuausnBm1CzqadVAbBTpjUzjLSMBKwt5HEiGBCSs6XqSWKzI38ZvEG9Dl14 J5mywoiWK/iOxDIeTzJPMzGm9/UZuMVERQA4T+hS5AHzWU6cHDv38HZ683+RvvitDR8G t/GkelkeyRfarrbMUtQyQ/eXsV5EQ4J3XW6l7V+f6NXVQMnWgiBhqFFDN7EV9AQureuN M1Qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=QH3LMcHNCCzm3aa25H8eDrtBCAi7yX53HYmOInyC/qs=; b=MxkZmjzkmqxYpMM2r6Ku+2zR968/rWkMaq/kO3kxR2n2llynXzL2OxIulx4KmJbDA5 UhEQ/HklUKNEMXus2eo9UE71sY8AwgtwYhlA+fQXCzJ8A8Rr+n6BgS4RybMYqYew/CLK V1jJ/8NDCV8p2TyHSK7+ruCZVmf2dKnnzrTnWOJzMfzGG5Y7Enp15wYq2TEzS710d9co gDI7Tr9cMTIikYJ/80fzi23BCoEfbV0KBl+6CJuJ0L1ZHXIYpoiCzfP6NrDLfrGbcyvy 3faaUIsNRiEKbwMV32QKkHmp8pqRH2THKXXhmtR9fjZufqd92KYS9FgWXpvYzXotaprC Sa5Q== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d5si7758688edn.209.2021.10.21.06.56.23; Thu, 21 Oct 2021 06:56:47 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230329AbhJUN4e (ORCPT + 99 others); Thu, 21 Oct 2021 09:56:34 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:29924 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230372AbhJUN4c (ORCPT ); Thu, 21 Oct 2021 09:56:32 -0400 Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4HZpkW3tcdzbnJm; Thu, 21 Oct 2021 21:49:39 +0800 (CST) Received: from dggpeml500006.china.huawei.com (7.185.36.76) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Thu, 21 Oct 2021 21:54:13 +0800 Received: from compute.localdomain (10.175.112.70) by dggpeml500006.china.huawei.com (7.185.36.76) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Thu, 21 Oct 2021 21:54:13 +0800 From: Zhang Changzhong To: Robin van der Gracht , Oleksij Rempel , , Oliver Hartkopp , Marc Kleine-Budde , "David S. Miller" , Jakub Kicinski CC: Zhang Changzhong , , , Subject: [PATCH net 3/3] can: j1939: j1939_tp_cmd_recv(): check the dst address of TP.CM_BAM Date: Thu, 21 Oct 2021 22:04:17 +0800 Message-ID: <1634825057-47915-4-git-send-email-zhangchangzhong@huawei.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1634825057-47915-1-git-send-email-zhangchangzhong@huawei.com> References: <1634825057-47915-1-git-send-email-zhangchangzhong@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.112.70] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpeml500006.china.huawei.com (7.185.36.76) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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)) + return; fallthrough; case J1939_TP_CMD_RTS: if (skcb->addr.type != extd) -- 2.9.5