From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E52D6155335; Mon, 16 Sep 2024 12:07:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726488436; cv=none; b=WcAj9r9YFft89JdTY+1r4esa4MzKjrQXAZd8QKiPwaG5xHMRQ23JdOpjDlwXqo8E/JwfqxX3er6L+rBCRxZv5hh0tGdOeyT2VzPkEaBAZexgbmQF4LGv6ZMMfavrWWzWitxdKRzIoWcnwyX41ciXqjr8JuflLmU5+6bhLaicBls= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726488436; c=relaxed/simple; bh=PztwzymDO6+H7pGGuqc1QxXXCrVn44L3eeCOR+4N9QY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=umTR1erdrL6j1CWb2JkVBMylzEtAYxmsXKk4eIJjZXrnzq5Q8zmoNZrCC8axHQlSKFRMasO//gmOS/Op+HueWxoq4VKDOy3YBpBcf8BCumuAxh63Ku9Cr5R/SJcMerYNK+G+4uCysi0n9CNr+PJ+HObi/is/IOmpA0IcOLD/mIc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=swkGdwp0; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="swkGdwp0" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6D3D4C4CEC4; Mon, 16 Sep 2024 12:07:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1726488435; bh=PztwzymDO6+H7pGGuqc1QxXXCrVn44L3eeCOR+4N9QY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=swkGdwp0uWyOnqdwr2knpLQNAEqbqs3Rb5vs4N9+UNHgC+PYIM0MW1+1P1iM9s4wK YiTyEWCEoVX/4Hk0segL0i7MTiiurwlgabgBTXpS763WsS5iczEa68PHetjWdvnQZh OyvmkVcjhXwSBt7iDo39JlUfSa0dhLtqRyVhulXA= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Eric Dumazet , Sean Anderson , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.10 095/121] net: dpaa: Pad packets to ETH_ZLEN Date: Mon, 16 Sep 2024 13:44:29 +0200 Message-ID: <20240916114232.268466740@linuxfoundation.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240916114228.914815055@linuxfoundation.org> References: <20240916114228.914815055@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Sean Anderson [ Upstream commit cbd7ec083413c6a2e0c326d49e24ec7d12c7a9e0 ] When sending packets under 60 bytes, up to three bytes of the buffer following the data may be leaked. Avoid this by extending all packets to ETH_ZLEN, ensuring nothing is leaked in the padding. This bug can be reproduced by running $ ping -s 11 destination Fixes: 9ad1a3749333 ("dpaa_eth: add support for DPAA Ethernet") Suggested-by: Eric Dumazet Signed-off-by: Sean Anderson Reviewed-by: Eric Dumazet Link: https://patch.msgid.link/20240910143144.1439910-1-sean.anderson@linux.dev Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c index 946c3d3b69d9..669fb5804d3b 100644 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c @@ -2285,12 +2285,12 @@ static netdev_tx_t dpaa_start_xmit(struct sk_buff *skb, struct net_device *net_dev) { const int queue_mapping = skb_get_queue_mapping(skb); - bool nonlinear = skb_is_nonlinear(skb); struct rtnl_link_stats64 *percpu_stats; struct dpaa_percpu_priv *percpu_priv; struct netdev_queue *txq; struct dpaa_priv *priv; struct qm_fd fd; + bool nonlinear; int offset = 0; int err = 0; @@ -2300,6 +2300,13 @@ dpaa_start_xmit(struct sk_buff *skb, struct net_device *net_dev) qm_fd_clear_fd(&fd); + /* Packet data is always read as 32-bit words, so zero out any part of + * the skb which might be sent if we have to pad the packet + */ + if (__skb_put_padto(skb, ETH_ZLEN, false)) + goto enomem; + + nonlinear = skb_is_nonlinear(skb); if (!nonlinear) { /* We're going to store the skb backpointer at the beginning * of the data buffer, so we need a privately owned skb -- 2.43.0