Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B301CC433EF for ; Mon, 15 Nov 2021 17:29:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9CEAA6329D for ; Mon, 15 Nov 2021 17:29:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236901AbhKORcj (ORCPT ); Mon, 15 Nov 2021 12:32:39 -0500 Received: from mail.kernel.org ([198.145.29.99]:48804 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236932AbhKORPP (ORCPT ); Mon, 15 Nov 2021 12:15:15 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 64A6161C15; Mon, 15 Nov 2021 17:11:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1636996306; bh=y+M0CDoxqRUTAzlF3RvjbE5fPWu7c1FTBhFIt1JLHbo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ktABSP9Kf0NDR3fM6jagZW8TDW/w2PpPq9nCPovexXF8VuCS1BgcY1JI5NbMjHPM+ OFL5EPgGtrdMzWPx0cQ8pfc9Owi+FNdT7pXEncAVMCKQroqlvUHKb6sZyNHGC4yW2o kPCERV/tMiRI9Xlc4zIy0PTK2gdSYCJKF9/NoruQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhang Changzhong , Oleksij Rempel , Marc Kleine-Budde Subject: [PATCH 5.4 091/355] can: j1939: j1939_tp_cmd_recv(): ignore abort message in the BAM transport Date: Mon, 15 Nov 2021 18:00:15 +0100 Message-Id: <20211115165316.745896063@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211115165313.549179499@linuxfoundation.org> References: <20211115165313.549179499@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Zhang Changzhong commit c0f49d98006f2db3333b917caac65bce2af9865c upstream. This patch prevents BAM transport from being closed by receiving abort message, as specified in SAE-J1939-82 2015 (A.3.3 Row 4). Fixes: 9d71dd0c7009 ("can: add support of SAE J1939 protocol") Link: https://lore.kernel.org/all/1635431907-15617-2-git-send-email-zhangchangzhong@huawei.com Cc: stable@vger.kernel.org Signed-off-by: Zhang Changzhong Acked-by: Oleksij Rempel Signed-off-by: Marc Kleine-Budde Signed-off-by: Greg Kroah-Hartman --- net/can/j1939/transport.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/net/can/j1939/transport.c +++ b/net/can/j1939/transport.c @@ -2065,6 +2065,12 @@ static void j1939_tp_cmd_recv(struct j19 break; case J1939_ETP_CMD_ABORT: /* && J1939_TP_CMD_ABORT */ + if (j1939_cb_is_broadcast(skcb)) { + netdev_err_once(priv->ndev, "%s: abort to broadcast (%02x), ignoring!\n", + __func__, skcb->addr.sa); + return; + } + if (j1939_tp_im_transmitter(skcb)) j1939_xtp_rx_abort(priv, skb, true);