mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH iwl-net] idpf: free the RDMA auxiliary device ID after deleting the device
@ 2026-11-18  5:16 Changyul Lee
  2026-11-23 16:30 ` Simon Horman
  0 siblings, 1 reply; 2+ messages in thread
From: Changyul Lee @ 2026-11-18  5:16 UTC (permalink / raw)
  To: Tony Nguyen, Przemek Kitszel
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Joshua Hay, Jacob Keller, Aleksandr Loktionov,
	Vadim Fedorenko, intel-wired-lan, netdev, linux-kernel,
	Changyul Lee

idpf_unplug_aux_dev() returns the ID to idpf_idc_ida before
auxiliary_device_delete() removes the device. If another idpf device
plugs an RDMA auxiliary device in between, it can get the same ID, and
its auxiliary_device_add() fails with -EEXIST because the old
"idpf.<vendor>.rdma.core.<id>" or "idpf.<vendor>.rdma.vdev.<id>" device
is still registered. RDMA is then not set up on that device.

Free the ID after auxiliary_device_delete(). It still has to be freed
before auxiliary_device_uninit(), whose release callback frees adev.

Fixes: 65637c3a1811 ("idpf: fix UAF in RDMA core aux dev deinitialization")
Signed-off-by: Changyul Lee <lcy8047@gmail.com>
---
Found with a static analysis tool we are developing.

Compile-tested only, with x86_64_defconfig plus IDPF and W=1.

 drivers/net/ethernet/intel/idpf/idpf_idc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/idpf/idpf_idc.c b/drivers/net/ethernet/intel/idpf/idpf_idc.c
index b6cd1c25ae5d..9d3c55854477 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_idc.c
+++ b/drivers/net/ethernet/intel/idpf/idpf_idc.c
@@ -253,9 +253,8 @@ static void idpf_unplug_aux_dev(struct auxiliary_device *adev)
 	if (!adev)
 		return;
 
-	ida_free(&idpf_idc_ida, adev->id);
-
 	auxiliary_device_delete(adev);
+	ida_free(&idpf_idc_ida, adev->id);
 	auxiliary_device_uninit(adev);
 }
 

base-commit: 7475ea8b58616b33c04afb976cf0fbaad9dd63fb
-- 
2.43.0


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

* Re: [PATCH iwl-net] idpf: free the RDMA auxiliary device ID after deleting the device
  2026-11-18  5:16 [PATCH iwl-net] idpf: free the RDMA auxiliary device ID after deleting the device Changyul Lee
@ 2026-11-23 16:30 ` Simon Horman
  0 siblings, 0 replies; 2+ messages in thread
From: Simon Horman @ 2026-11-23 16:30 UTC (permalink / raw)
  To: Changyul Lee
  Cc: Tony Nguyen, Przemek Kitszel, Andrew Lunn, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Joshua Hay,
	Jacob Keller, Aleksandr Loktionov, Vadim Fedorenko,
	intel-wired-lan, netdev, linux-kernel

On Wed, Nov 18, 2026 at 12:16:11AM -0500, Changyul Lee wrote:
> idpf_unplug_aux_dev() returns the ID to idpf_idc_ida before
> auxiliary_device_delete() removes the device. If another idpf device
> plugs an RDMA auxiliary device in between, it can get the same ID, and
> its auxiliary_device_add() fails with -EEXIST because the old
> "idpf.<vendor>.rdma.core.<id>" or "idpf.<vendor>.rdma.vdev.<id>" device
> is still registered. RDMA is then not set up on that device.
> 
> Free the ID after auxiliary_device_delete(). It still has to be freed
> before auxiliary_device_uninit(), whose release callback frees adev.
> 
> Fixes: 65637c3a1811 ("idpf: fix UAF in RDMA core aux dev deinitialization")
> Signed-off-by: Changyul Lee <lcy8047@gmail.com>
> ---
> Found with a static analysis tool we are developing.
> 
> Compile-tested only, with x86_64_defconfig plus IDPF and W=1.

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


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

end of thread, other threads:[~2026-11-23 16:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-18  5:16 [PATCH iwl-net] idpf: free the RDMA auxiliary device ID after deleting the device Changyul Lee
2026-11-23 16:30 ` Simon Horman

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

all inboxes | Powered by JetHome®