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 4F0F51F4FC6; Wed, 6 Nov 2024 13:04:44 +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=1730898284; cv=none; b=XlkuUV8Yp14hwfHwW1J1NQyI7Pa2EDNpXby8115UrDMBzOAmWy6YKoc55ALBMTEhEKCYCHM/0PesWv5fiSShyOcB61g89pjiUGM5fy7OiSF6e8pB0mo+pLA2TxMM+CVI/88fOvliTC8cQdtG7RI9SJ9fu+RkP1ib8xcv0+gPCAI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730898284; c=relaxed/simple; bh=Mh5XyRHyNV5vNgUlkZe2j8JTi56Ks6iqNOLD26bvInE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=F4UAkyWP176yaMLLNgE0xtQ52/MaXthQ/KcKMllsZ4zcAYeh/t/rgt/OZAkwdlbrUVkGOeRJFKtPptC3FRpbl9vaeU6QjmPn/c67b5dYKCthe9DRHjasXbZzFSHOo/TU5H7DKlQi/gf7eghP4cNkIAI3LOiaJRoXK9I4iyjCrLA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=D0XviMLx; 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="D0XviMLx" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8FC9CC4CECD; Wed, 6 Nov 2024 13:04:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1730898284; bh=Mh5XyRHyNV5vNgUlkZe2j8JTi56Ks6iqNOLD26bvInE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D0XviMLxg0Z4zKRhm/I++HSjoWCUlibs3n0UdxTedr8DDbX+VHnIy5VatEZXjIOuj 7gzfqGPnGlvVUOIy04FvQchgb1pfO/dcBBs1VqfBCglGWu1qKynHAT0ZY8ZYMCc2a4 1pekWv3Hl0IaCDDm+2lVxTzLAnwUKxrzLXzYtgeA= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Aleksander Jan Bajkowski , Jacob Keller , Florian Fainelli , Paolo Abeni , Sasha Levin Subject: [PATCH 5.4 185/462] net: ethernet: lantiq_etop: fix memory disclosure Date: Wed, 6 Nov 2024 13:01:18 +0100 Message-ID: <20241106120336.084685280@linuxfoundation.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241106120331.497003148@linuxfoundation.org> References: <20241106120331.497003148@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 5.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Aleksander Jan Bajkowski [ Upstream commit 45c0de18ff2dc9af01236380404bbd6a46502c69 ] When applying padding, the buffer is not zeroed, which results in memory disclosure. The mentioned data is observed on the wire. This patch uses skb_put_padto() to pad Ethernet frames properly. The mentioned function zeroes the expanded buffer. In case the packet cannot be padded it is silently dropped. Statistics are also not incremented. This driver does not support statistics in the old 32-bit format or the new 64-bit format. These will be added in the future. In its current form, the patch should be easily backported to stable versions. Ethernet MACs on Amazon-SE and Danube cannot do padding of the packets in hardware, so software padding must be applied. Fixes: 504d4721ee8e ("MIPS: Lantiq: Add ethernet driver") Signed-off-by: Aleksander Jan Bajkowski Reviewed-by: Jacob Keller Reviewed-by: Florian Fainelli Link: https://patch.msgid.link/20240923214949.231511-2-olek2@wp.pl Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin --- drivers/net/ethernet/lantiq_etop.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/lantiq_etop.c b/drivers/net/ethernet/lantiq_etop.c index 932796080c7f7..5121e175f313f 100644 --- a/drivers/net/ethernet/lantiq_etop.c +++ b/drivers/net/ethernet/lantiq_etop.c @@ -464,7 +464,9 @@ ltq_etop_tx(struct sk_buff *skb, struct net_device *dev) unsigned long flags; u32 byte_offset; - len = skb->len < ETH_ZLEN ? ETH_ZLEN : skb->len; + if (skb_put_padto(skb, ETH_ZLEN)) + return NETDEV_TX_OK; + len = skb->len; if ((desc->ctl & (LTQ_DMA_OWN | LTQ_DMA_C)) || ch->skb[ch->dma.desc]) { netdev_err(dev, "tx ring full\n"); -- 2.43.0