public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH net v3 0/1] net: ethernet: lantiq_etop: fix memory disclosure
@ 2024-09-23 21:49 Aleksander Jan Bajkowski
  2024-09-23 21:49 ` [PATCH net v3 1/1] " Aleksander Jan Bajkowski
  2024-10-01  9:00 ` [PATCH net v3 0/1] " patchwork-bot+netdevbpf
  0 siblings, 2 replies; 6+ messages in thread
From: Aleksander Jan Bajkowski @ 2024-09-23 21:49 UTC (permalink / raw)
  To: davem, edumazet, kuba, pabeni, olek2, horms, jacob.e.keller, john,
	ralf, ralph.hempel, netdev, linux-kernel

Changes in v3:
 - back to the use of the temporary 'len' variable

Changes in v2:
 - clarified questions about statistics in the commit description
 - rebased on current master

Aleksander Jan Bajkowski (1):
  net: ethernet: lantiq_etop: fix memory disclosure

 drivers/net/ethernet/lantiq_etop.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

-- 
2.39.5


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH net v3 1/1] net: ethernet: lantiq_etop: fix memory disclosure
  2024-09-23 21:49 [PATCH net v3 0/1] net: ethernet: lantiq_etop: fix memory disclosure Aleksander Jan Bajkowski
@ 2024-09-23 21:49 ` Aleksander Jan Bajkowski
  2024-09-23 21:54   ` Keller, Jacob E
                     ` (2 more replies)
  2024-10-01  9:00 ` [PATCH net v3 0/1] " patchwork-bot+netdevbpf
  1 sibling, 3 replies; 6+ messages in thread
From: Aleksander Jan Bajkowski @ 2024-09-23 21:49 UTC (permalink / raw)
  To: davem, edumazet, kuba, pabeni, olek2, horms, jacob.e.keller, john,
	ralf, ralph.hempel, netdev, linux-kernel

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 <olek2@wp.pl>
---
 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 3c289bfe0a09..7179271f63b6 100644
--- a/drivers/net/ethernet/lantiq_etop.c
+++ b/drivers/net/ethernet/lantiq_etop.c
@@ -481,7 +481,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.39.5


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* RE: [PATCH net v3 1/1] net: ethernet: lantiq_etop: fix memory disclosure
  2024-09-23 21:49 ` [PATCH net v3 1/1] " Aleksander Jan Bajkowski
@ 2024-09-23 21:54   ` Keller, Jacob E
  2024-09-23 22:22   ` Florian Fainelli
  2024-10-01  8:57   ` Paolo Abeni
  2 siblings, 0 replies; 6+ messages in thread
From: Keller, Jacob E @ 2024-09-23 21:54 UTC (permalink / raw)
  To: Aleksander Jan Bajkowski, davem@davemloft.net,
	edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
	horms@kernel.org, john@phrozen.org, ralf@linux-mips.org,
	ralph.hempel@lantiq.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org



> -----Original Message-----
> From: Aleksander Jan Bajkowski <olek2@wp.pl>
> Sent: Monday, September 23, 2024 2:50 PM
> To: davem@davemloft.net; edumazet@google.com; kuba@kernel.org;
> pabeni@redhat.com; olek2@wp.pl; horms@kernel.org; Keller, Jacob E
> <jacob.e.keller@intel.com>; john@phrozen.org; ralf@linux-mips.org;
> ralph.hempel@lantiq.com; netdev@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: [PATCH net v3 1/1] net: ethernet: lantiq_etop: fix memory disclosure
> 
> 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 <olek2@wp.pl>
> ---

Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net v3 1/1] net: ethernet: lantiq_etop: fix memory disclosure
  2024-09-23 21:49 ` [PATCH net v3 1/1] " Aleksander Jan Bajkowski
  2024-09-23 21:54   ` Keller, Jacob E
@ 2024-09-23 22:22   ` Florian Fainelli
  2024-10-01  8:57   ` Paolo Abeni
  2 siblings, 0 replies; 6+ messages in thread
From: Florian Fainelli @ 2024-09-23 22:22 UTC (permalink / raw)
  To: Aleksander Jan Bajkowski, davem, edumazet, kuba, pabeni, horms,
	jacob.e.keller, john, ralf, ralph.hempel, netdev, linux-kernel

On 9/23/24 14:49, Aleksander Jan Bajkowski wrote:
> 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 <olek2@wp.pl>

Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>

Thanks for taking in the suggsetion!
-- 
Florian

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net v3 1/1] net: ethernet: lantiq_etop: fix memory disclosure
  2024-09-23 21:49 ` [PATCH net v3 1/1] " Aleksander Jan Bajkowski
  2024-09-23 21:54   ` Keller, Jacob E
  2024-09-23 22:22   ` Florian Fainelli
@ 2024-10-01  8:57   ` Paolo Abeni
  2 siblings, 0 replies; 6+ messages in thread
From: Paolo Abeni @ 2024-10-01  8:57 UTC (permalink / raw)
  To: Aleksander Jan Bajkowski, davem, edumazet, kuba, horms,
	jacob.e.keller, john, ralf, ralph.hempel, netdev, linux-kernel



On 9/23/24 23:49, Aleksander Jan Bajkowski wrote:
> 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 <olek2@wp.pl>

For future submissions, please avoid adding the cover letter in case of 
a single patch.

Thanks,

Paolo


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net v3 0/1] net: ethernet: lantiq_etop: fix memory disclosure
  2024-09-23 21:49 [PATCH net v3 0/1] net: ethernet: lantiq_etop: fix memory disclosure Aleksander Jan Bajkowski
  2024-09-23 21:49 ` [PATCH net v3 1/1] " Aleksander Jan Bajkowski
@ 2024-10-01  9:00 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-10-01  9:00 UTC (permalink / raw)
  To: Aleksander Jan Bajkowski
  Cc: davem, edumazet, kuba, pabeni, horms, jacob.e.keller, john, ralf,
	ralph.hempel, netdev, linux-kernel

Hello:

This patch was applied to netdev/net.git (main)
by Paolo Abeni <pabeni@redhat.com>:

On Mon, 23 Sep 2024 23:49:48 +0200 you wrote:
> Changes in v3:
>  - back to the use of the temporary 'len' variable
> 
> Changes in v2:
>  - clarified questions about statistics in the commit description
>  - rebased on current master
> 
> [...]

Here is the summary with links:
  - [net,v3,1/1] net: ethernet: lantiq_etop: fix memory disclosure
    https://git.kernel.org/netdev/net/c/45c0de18ff2d

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-10-01  9:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-23 21:49 [PATCH net v3 0/1] net: ethernet: lantiq_etop: fix memory disclosure Aleksander Jan Bajkowski
2024-09-23 21:49 ` [PATCH net v3 1/1] " Aleksander Jan Bajkowski
2024-09-23 21:54   ` Keller, Jacob E
2024-09-23 22:22   ` Florian Fainelli
2024-10-01  8:57   ` Paolo Abeni
2024-10-01  9:00 ` [PATCH net v3 0/1] " patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox