Skip to content

Commit 85308d9

Browse files
hyperenjuanguy11
authored andcommitted
ixgbe: fix memory leak and use-after-free in ixgbe_recovery_probe()
The error path of ixgbe_recovery_probe() has two memory bugs. For non-E610 adapters, the function jumps to clean_up_probe without calling devlink_free(), leaking the devlink instance and its embedded adapter structure. For E610 adapters, devlink_free() is called at shutdown_aci, but clean_up_probe then accesses adapter->state, sometimes triggering use-after-free because adapter is embedded in devlink. This UAF is similar to the one recently reported in ixgbe_remove(). (Link) Fix both issues by moving devlink_free() after adapter->state access, aligning with the cleanup order in ixgbe_probe(). Link: https://lore.kernel.org/intel-wired-lan/20250828020558.1450422-1-den@valinux.co.jp/ Fixes: 29cb3b8 ("ixgbe: add E610 implementation of FW recovery mode") Signed-off-by: Kohei Enju <enjuk@amazon.com> Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com> Reviewed-by: Jedrzej Jagielski <jedrzej.jagielski@intel.com> Tested-by: Rinitha S <sx.rinitha@intel.com> (A Contingent worker at Intel) Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
1 parent 9a0f81f commit 85308d9

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/net/ethernet/intel/ixgbe/ixgbe_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11507,10 +11507,10 @@ static int ixgbe_recovery_probe(struct ixgbe_adapter *adapter)
1150711507
shutdown_aci:
1150811508
mutex_destroy(&adapter->hw.aci.lock);
1150911509
ixgbe_release_hw_control(adapter);
11510-
devlink_free(adapter->devlink);
1151111510
clean_up_probe:
1151211511
disable_dev = !test_and_set_bit(__IXGBE_DISABLED, &adapter->state);
1151311512
free_netdev(netdev);
11513+
devlink_free(adapter->devlink);
1151411514
pci_release_mem_regions(pdev);
1151511515
if (disable_dev)
1151611516
pci_disable_device(pdev);

0 commit comments

Comments
 (0)