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 2094414D2B3; Mon, 16 Sep 2024 12:01:22 +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=1726488083; cv=none; b=cdoLd6ZvMogdagdQijNbVeVCfXft+z0j+0UXdJc0zGiRFGnDbd1SUTkF5zy5r+nGCsjjuf6jLDMF9aBblctFKzvzYr1zbJf3xOIqu7YQ7a+plG5MmgwtqZLs69yxH7ktM6O5HT3IOjL81efNlYxZnR2e4XfNU5/zLvrEOkwzCHU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726488083; c=relaxed/simple; bh=bNT4JQjCzgPf/JvrzDw/0pNiqKvV4q28GhS8Suikc+U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MhBYM5OfmySsYn2eCbudWcDtcAQZ+Bo8PRPwIirzc7eqEJJiDrLoj5iKb2ISwjDeCkted8DAMEmHPjFcIRct2tiKCVn7mwua9v94UvsVpL77/YCLYzZQgOBub0dysQXmirWT8/yfiEekqvHS8aDA5gBmHWgcZk/XHSBYIe1IxlY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=sc5vxflO; 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="sc5vxflO" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3A6A4C4CEC4; Mon, 16 Sep 2024 12:01:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1726488082; bh=bNT4JQjCzgPf/JvrzDw/0pNiqKvV4q28GhS8Suikc+U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sc5vxflOL2QD75goAvs5yUx+FQ6a3GGR0IBcnEulr8VCRP54CSHrFEQif2ePg8h9H 8nNMZE5Y3dAs5H0P3aBF9Tm3pfAqt54vPXZikZSCuBZBhyuMckIRO0ad49qBHKl93V XV181p/N9T288T0qsRNQTRdneQHP7dRWdCS1KstY= 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.1 53/63] net: dpaa: Pad packets to ETH_ZLEN Date: Mon, 16 Sep 2024 13:44:32 +0200 Message-ID: <20240916114222.937892012@linuxfoundation.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240916114221.021192667@linuxfoundation.org> References: <20240916114221.021192667@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-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 19506f2be4d4..6f5c22861dc9 100644 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c @@ -2275,12 +2275,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; @@ -2290,6 +2290,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