netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] netdevsim: fix UaF when counting Tx stats
@ 2025-06-20 17:40 Jakub Kicinski
  2025-06-20 17:53 ` David Miller
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jakub Kicinski @ 2025-06-20 17:40 UTC (permalink / raw)
  To: davem
  Cc: netdev, edumazet, pabeni, andrew+netdev, horms, Jakub Kicinski,
	leitao, joe

skb may be freed as soon as we put it on the rx queue.
Use the len variable like the code did prior to the conversion.

Fixes: f9e2511d80c2 ("netdevsim: migrate to dstats stats collection")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
CC: leitao@debian.org
CC: joe@dama.to
---
 drivers/net/netdevsim/netdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/netdevsim/netdev.c b/drivers/net/netdevsim/netdev.c
index 7f2809be5d48..e36d3e846c2d 100644
--- a/drivers/net/netdevsim/netdev.c
+++ b/drivers/net/netdevsim/netdev.c
@@ -93,7 +93,7 @@ static netdev_tx_t nsim_start_xmit(struct sk_buff *skb, struct net_device *dev)
 		hrtimer_start(&rq->napi_timer, us_to_ktime(5), HRTIMER_MODE_REL);
 
 	rcu_read_unlock();
-	dev_dstats_tx_add(dev, skb->len);
+	dev_dstats_tx_add(dev, len);
 	return NETDEV_TX_OK;
 
 out_drop_free:
-- 
2.49.0


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

* Re: [PATCH net-next] netdevsim: fix UaF when counting Tx stats
  2025-06-20 17:40 [PATCH net-next] netdevsim: fix UaF when counting Tx stats Jakub Kicinski
@ 2025-06-20 17:53 ` David Miller
  2025-06-20 18:24 ` Breno Leitao
  2025-06-22 18:00 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2025-06-20 17:53 UTC (permalink / raw)
  To: kuba; +Cc: netdev, edumazet, pabeni, andrew+netdev, horms, leitao, joe

From: Jakub Kicinski <kuba@kernel.org>
Date: Fri, 20 Jun 2025 10:40:07 -0700

> skb may be freed as soon as we put it on the rx queue.
> Use the len variable like the code did prior to the conversion.
> 
> Fixes: f9e2511d80c2 ("netdevsim: migrate to dstats stats collection")
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Acked-by: David S. Miller <davem@davemloft.net>

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

* Re: [PATCH net-next] netdevsim: fix UaF when counting Tx stats
  2025-06-20 17:40 [PATCH net-next] netdevsim: fix UaF when counting Tx stats Jakub Kicinski
  2025-06-20 17:53 ` David Miller
@ 2025-06-20 18:24 ` Breno Leitao
  2025-06-22 18:00 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Breno Leitao @ 2025-06-20 18:24 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: davem, netdev, edumazet, pabeni, andrew+netdev, horms, joe

On Fri, Jun 20, 2025 at 10:40:07AM -0700, Jakub Kicinski wrote:
> skb may be freed as soon as we put it on the rx queue.
> Use the len variable like the code did prior to the conversion.
> 
> Fixes: f9e2511d80c2 ("netdevsim: migrate to dstats stats collection")
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Reviewed-by: Breno Leitao <leitao@debian.org>

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

* Re: [PATCH net-next] netdevsim: fix UaF when counting Tx stats
  2025-06-20 17:40 [PATCH net-next] netdevsim: fix UaF when counting Tx stats Jakub Kicinski
  2025-06-20 17:53 ` David Miller
  2025-06-20 18:24 ` Breno Leitao
@ 2025-06-22 18:00 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-06-22 18:00 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: davem, netdev, edumazet, pabeni, andrew+netdev, horms, leitao,
	joe

Hello:

This patch was applied to netdev/net-next.git (main)
by David S. Miller <davem@davemloft.net>:

On Fri, 20 Jun 2025 10:40:07 -0700 you wrote:
> skb may be freed as soon as we put it on the rx queue.
> Use the len variable like the code did prior to the conversion.
> 
> Fixes: f9e2511d80c2 ("netdevsim: migrate to dstats stats collection")
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
> CC: leitao@debian.org
> CC: joe@dama.to
> 
> [...]

Here is the summary with links:
  - [net-next] netdevsim: fix UaF when counting Tx stats
    https://git.kernel.org/netdev/net-next/c/5e95c0a3a55a

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

end of thread, other threads:[~2025-06-22 17:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-20 17:40 [PATCH net-next] netdevsim: fix UaF when counting Tx stats Jakub Kicinski
2025-06-20 17:53 ` David Miller
2025-06-20 18:24 ` Breno Leitao
2025-06-22 18: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).