Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3491592pxf; Mon, 29 Mar 2021 03:53:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx2k+42eBHIeTXVEqEQC6B7Y9cPTgdJakn/n/6Z7pquwSgatVGUEu9UAcb2zyV2V/w4IPWu X-Received: by 2002:a17:906:6044:: with SMTP id p4mr28110938ejj.82.1617015191931; Mon, 29 Mar 2021 03:53:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617015191; cv=none; d=google.com; s=arc-20160816; b=koXW5jWpJTtNXUhMVSgq4P1PePS/tnroiMdAfiDrUinZYMP6v1Et5h7Jn9fuWi3148 fOk86IghFpp98lFm0ANGp2H+jMSfFvWXaRsZaa8kolgSkTmLUHRoNL5IdSi7iH4DAwY7 ZGYvyhgwZqSODvm4/qTq+VFF+7YGJpB6cZZOXo5b8uEY15YQuIvGAChMEL2SEdvBjNJ5 OKjW1fc9wF7k1Coo5QlF9b77RNC6t7ofcZoQihwBXn0TyAco6Kcct4ZrpkgqZCXPpETI nM1NeBMuJr+16df5U878C5s3dOpPoK0jxwH3pi2DfDNyCXLxuiI3wHjMj7X8fAbHfaOe 6hxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=AelyVDXHehjkgsTaA86mxW+NY5/VbGdKz6Brv4aKVtE=; b=sqLBZULmJA0eMuF5s/nES7XfLbisw6D9Cegdl6bey4JcMVgs0PlfnLqYtmQxjZJk2K s6ry26jZG2Tq/w5Uxrp5YdW4t7pkKnkOGz/dFZnDjeKn9x1Ph/JGHXMn9ZRgM89tvzLV oJ+UVGBKfLiRJv4jolQyvCSB5J92yZpH6i3ubzPG6ew7fXJLnVxuuKkMF3mrShJYdjEo xsVZJM19ibHHqj5Z35uT0IdivLZEhfGpTXbE1E8gzloOwF4iCTHkboY3u7eu98N5iwz7 HStpRKsgXN1RdfmgJfb6w6GTbHCmgOb+s4X0rxGaJB0VdrZr6wbD7Zoyw76PanQbTMdT IO3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LySZCGbw; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a2si12826398edt.289.2021.03.29.03.52.49; Mon, 29 Mar 2021 03:53:11 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LySZCGbw; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235158AbhC2ImU (ORCPT + 99 others); Mon, 29 Mar 2021 04:42:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:41252 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233131AbhC2IYC (ORCPT ); Mon, 29 Mar 2021 04:24:02 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id BA43E614A7; Mon, 29 Mar 2021 08:23:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1617006230; bh=maZLklevpeKGFhw+kRt1hXzJbYfrna0g4eQsOohi0eE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LySZCGbw7H+gMuNAeJ4FiP5JbwycYAThkBX6sDdtyiAPjWlXHnojOtFOZUuOPHxs/ QYehEgyCM+MlpstPuyRA6/7UADvUaxsc2GTnw9ePFhXo5NFiPaj7nqvaHaKgAyPCE6 Fd/L9cRYnR+b2galW0dn8qt4d19Z0pXrm7HpS1Dg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marc Kleine-Budde , Oliver Hartkopp , Sasha Levin Subject: [PATCH 5.10 165/221] can: isotp: tx-path: zero initialize outgoing CAN frames Date: Mon, 29 Mar 2021 09:58:16 +0200 Message-Id: <20210329075634.646178240@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210329075629.172032742@linuxfoundation.org> References: <20210329075629.172032742@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: Oliver Hartkopp [ Upstream commit b5f020f82a8e41201c6ede20fa00389d6980b223 ] Commit d4eb538e1f48 ("can: isotp: TX-path: ensure that CAN frame flags are initialized") ensured the TX flags to be properly set for outgoing CAN frames. In fact the root cause of the issue results from a missing initialization of outgoing CAN frames created by isotp. This is no problem on the CAN bus as the CAN driver only picks the correctly defined content from the struct can(fd)_frame. But when the outgoing frames are monitored (e.g. with candump) we potentially leak some bytes in the unused content of struct can(fd)_frame. Fixes: e057dd3fc20f ("can: add ISO 15765-2:2016 transport protocol") Cc: Marc Kleine-Budde Link: https://lore.kernel.org/r/20210319100619.10858-1-socketcan@hartkopp.net Signed-off-by: Oliver Hartkopp Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin --- net/can/isotp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/net/can/isotp.c b/net/can/isotp.c index b01662d2f2cd..ea1e227b8e54 100644 --- a/net/can/isotp.c +++ b/net/can/isotp.c @@ -196,7 +196,7 @@ static int isotp_send_fc(struct sock *sk, int ae, u8 flowstatus) nskb->dev = dev; can_skb_set_owner(nskb, sk); ncf = (struct canfd_frame *)nskb->data; - skb_put(nskb, so->ll.mtu); + skb_put_zero(nskb, so->ll.mtu); /* create & send flow control reply */ ncf->can_id = so->txid; @@ -779,7 +779,7 @@ isotp_tx_burst: can_skb_prv(skb)->skbcnt = 0; cf = (struct canfd_frame *)skb->data; - skb_put(skb, so->ll.mtu); + skb_put_zero(skb, so->ll.mtu); /* create consecutive frame */ isotp_fill_dataframe(cf, so, ae, 0); @@ -887,7 +887,7 @@ static int isotp_sendmsg(struct socket *sock, struct msghdr *msg, size_t size) so->tx.idx = 0; cf = (struct canfd_frame *)skb->data; - skb_put(skb, so->ll.mtu); + skb_put_zero(skb, so->ll.mtu); /* take care of a potential SF_DL ESC offset for TX_DL > 8 */ off = (so->tx.ll_dl > CAN_MAX_DLEN) ? 1 : 0; -- 2.30.1