netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net: atm: fix use after free in lec_send()
@ 2025-03-14 10:10 Dan Carpenter
  2025-03-19 12:39 ` Simon Horman
  2025-03-20 10:00 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2025-03-14 10:10 UTC (permalink / raw)
  To: Simon Horman
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Simon Horman, netdev, linux-kernel, kernel-janitors

The ->send() operation frees skb so save the length before calling
->send() to avoid a use after free.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 net/atm/lec.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/atm/lec.c b/net/atm/lec.c
index ffef658862db..a948dd47c3f3 100644
--- a/net/atm/lec.c
+++ b/net/atm/lec.c
@@ -181,6 +181,7 @@ static void
 lec_send(struct atm_vcc *vcc, struct sk_buff *skb)
 {
 	struct net_device *dev = skb->dev;
+	unsigned int len = skb->len;
 
 	ATM_SKB(skb)->vcc = vcc;
 	atm_account_tx(vcc, skb);
@@ -191,7 +192,7 @@ lec_send(struct atm_vcc *vcc, struct sk_buff *skb)
 	}
 
 	dev->stats.tx_packets++;
-	dev->stats.tx_bytes += skb->len;
+	dev->stats.tx_bytes += len;
 }
 
 static void lec_tx_timeout(struct net_device *dev, unsigned int txqueue)
-- 
2.47.2


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

* Re: [PATCH net] net: atm: fix use after free in lec_send()
  2025-03-14 10:10 [PATCH net] net: atm: fix use after free in lec_send() Dan Carpenter
@ 2025-03-19 12:39 ` Simon Horman
  2025-03-20 10:00 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2025-03-19 12:39 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	netdev, linux-kernel, kernel-janitors

On Fri, Mar 14, 2025 at 01:10:57PM +0300, Dan Carpenter wrote:
> The ->send() operation frees skb so save the length before calling
> ->send() to avoid a use after free.
> 
> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>

Reviewed-by: Simon Horman <horms@kernel.org>


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

* Re: [PATCH net] net: atm: fix use after free in lec_send()
  2025-03-14 10:10 [PATCH net] net: atm: fix use after free in lec_send() Dan Carpenter
  2025-03-19 12:39 ` Simon Horman
@ 2025-03-20 10:00 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-03-20 10:00 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: horms, davem, edumazet, kuba, pabeni, netdev, linux-kernel,
	kernel-janitors

Hello:

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

On Fri, 14 Mar 2025 13:10:57 +0300 you wrote:
> The ->send() operation frees skb so save the length before calling
> ->send() to avoid a use after free.
> 
> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
>  net/atm/lec.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Here is the summary with links:
  - [net] net: atm: fix use after free in lec_send()
    https://git.kernel.org/netdev/net/c/f3009d0d6ab7

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] 3+ messages in thread

end of thread, other threads:[~2025-03-20  9:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-14 10:10 [PATCH net] net: atm: fix use after free in lec_send() Dan Carpenter
2025-03-19 12:39 ` Simon Horman
2025-03-20 10:00 ` 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;
as well as URLs for NNTP newsgroup(s).