All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] eth: fbnic: unlink NAPIs from queues on error to open
@ 2025-07-28 16:31 Jakub Kicinski
  2025-07-29 11:15 ` Simon Horman
  2025-08-05  0:30 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Jakub Kicinski @ 2025-07-28 16:31 UTC (permalink / raw)
  To: davem
  Cc: netdev, edumazet, pabeni, andrew+netdev, horms, Jakub Kicinski,
	Alexander Duyck, mohsin.bashr, vadim.fedorenko

CI hit a UaF in fbnic in the AF_XDP portion of the queues.py test.
The UaF is in the __sk_mark_napi_id_once() call in xsk_bind(),
NAPI has been freed. Looks like the device failed to open earlier,
and we lack clearing the NAPI pointer from the queue.

Fixes: 557d02238e05 ("eth: fbnic: centralize the queue count and NAPI<>queue setting")
Reviewed-by: Alexander Duyck <alexanderduyck@fb.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
CC: alexanderduyck@fb.com
CC: mohsin.bashr@gmail.com
CC: vadim.fedorenko@linux.dev
---
 drivers/net/ethernet/meta/fbnic/fbnic_netdev.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_netdev.c b/drivers/net/ethernet/meta/fbnic/fbnic_netdev.c
index 7bd7812d9c06..04bb6e7147a2 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic_netdev.c
+++ b/drivers/net/ethernet/meta/fbnic/fbnic_netdev.c
@@ -33,7 +33,7 @@ int __fbnic_open(struct fbnic_net *fbn)
 		dev_warn(fbd->dev,
 			 "Error %d sending host ownership message to the firmware\n",
 			 err);
-		goto free_resources;
+		goto err_reset_queues;
 	}
 
 	err = fbnic_time_start(fbn);
@@ -57,6 +57,8 @@ int __fbnic_open(struct fbnic_net *fbn)
 	fbnic_time_stop(fbn);
 release_ownership:
 	fbnic_fw_xmit_ownership_msg(fbn->fbd, false);
+err_reset_queues:
+	fbnic_reset_netif_queues(fbn);
 free_resources:
 	fbnic_free_resources(fbn);
 free_napi_vectors:
-- 
2.50.1


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

* Re: [PATCH net] eth: fbnic: unlink NAPIs from queues on error to open
  2025-07-28 16:31 [PATCH net] eth: fbnic: unlink NAPIs from queues on error to open Jakub Kicinski
@ 2025-07-29 11:15 ` Simon Horman
  2025-08-05  0:30 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2025-07-29 11:15 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: davem, netdev, edumazet, pabeni, andrew+netdev, Alexander Duyck,
	mohsin.bashr, vadim.fedorenko

On Mon, Jul 28, 2025 at 09:31:29AM -0700, Jakub Kicinski wrote:
> CI hit a UaF in fbnic in the AF_XDP portion of the queues.py test.
> The UaF is in the __sk_mark_napi_id_once() call in xsk_bind(),
> NAPI has been freed. Looks like the device failed to open earlier,
> and we lack clearing the NAPI pointer from the queue.
> 
> Fixes: 557d02238e05 ("eth: fbnic: centralize the queue count and NAPI<>queue setting")
> Reviewed-by: Alexander Duyck <alexanderduyck@fb.com>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Thanks,

I agree that the cited commit should have updated the unwind path as per
this patch.

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

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

* Re: [PATCH net] eth: fbnic: unlink NAPIs from queues on error to open
  2025-07-28 16:31 [PATCH net] eth: fbnic: unlink NAPIs from queues on error to open Jakub Kicinski
  2025-07-29 11:15 ` Simon Horman
@ 2025-08-05  0:30 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-08-05  0:30 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: davem, netdev, edumazet, pabeni, andrew+netdev, horms,
	alexanderduyck, mohsin.bashr, vadim.fedorenko

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Mon, 28 Jul 2025 09:31:29 -0700 you wrote:
> CI hit a UaF in fbnic in the AF_XDP portion of the queues.py test.
> The UaF is in the __sk_mark_napi_id_once() call in xsk_bind(),
> NAPI has been freed. Looks like the device failed to open earlier,
> and we lack clearing the NAPI pointer from the queue.
> 
> Fixes: 557d02238e05 ("eth: fbnic: centralize the queue count and NAPI<>queue setting")
> Reviewed-by: Alexander Duyck <alexanderduyck@fb.com>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> 
> [...]

Here is the summary with links:
  - [net] eth: fbnic: unlink NAPIs from queues on error to open
    https://git.kernel.org/netdev/net/c/4b31bcb025cb

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-08-05  0:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-28 16:31 [PATCH net] eth: fbnic: unlink NAPIs from queues on error to open Jakub Kicinski
2025-07-29 11:15 ` Simon Horman
2025-08-05  0:30 ` patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.