]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ice: fix double free in ice_sf_eth_activate() error path
authorGuangshuo Li <lgs201920130244@gmail.com>
Fri, 17 Apr 2026 00:53:27 +0000 (17:53 -0700)
committerJakub Kicinski <kuba@kernel.org>
Sat, 18 Apr 2026 19:01:33 +0000 (12:01 -0700)
When auxiliary_device_add() fails, ice_sf_eth_activate() jumps to
aux_dev_uninit and calls auxiliary_device_uninit(&sf_dev->adev).

The device release callback ice_sf_dev_release() frees sf_dev, but
the current error path falls through to sf_dev_free and calls
kfree(sf_dev) again, causing a double free.

Keep kfree(sf_dev) for the auxiliary_device_init() failure path, but
avoid falling through to sf_dev_free after auxiliary_device_uninit().

Fixes: 13acc5c4cdbe ("ice: subfunction activation and base devlink ops")
Cc: stable@vger.kernel.org
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Link: https://patch.msgid.link/20260416-iwl-net-submission-2026-04-14-v2-3-686c33c9828d@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/intel/ice/ice_sf_eth.c

index 2cf04bc6edceb1d081e8371d5da9b0149989ec5f..a730aa368c92f6705af13d8f276fae6c673bc320 100644 (file)
@@ -305,6 +305,8 @@ ice_sf_eth_activate(struct ice_dynamic_port *dyn_port,
 
 aux_dev_uninit:
        auxiliary_device_uninit(&sf_dev->adev);
+       return err;
+
 sf_dev_free:
        kfree(sf_dev);
 xa_erase: