Skip to content

Commit bea2662

Browse files
jmberg-intelKalle Valo
authored andcommitted
iwlwifi: fix use-after-free
If no firmware was present at all (or, presumably, all of the firmware files failed to parse), we end up unbinding by calling device_release_driver(), which calls remove(), which then in iwlwifi calls iwl_drv_stop(), freeing the 'drv' struct. However the new code I added will still erroneously access it after it was freed. Set 'failure=false' in this case to avoid the access, all data was already freed anyway. Cc: [email protected] Reported-by: Stefan Agner <[email protected]> Reported-by: Wolfgang Walter <[email protected]> Reported-by: Jason Self <[email protected]> Reported-by: Dominik Behr <[email protected]> Reported-by: Marek Marczykowski-Górecki <[email protected]> Fixes: ab07506 ("iwlwifi: fix leaks/bad data after failed firmware load") Signed-off-by: Johannes Berg <[email protected]> Signed-off-by: Kalle Valo <[email protected]> Link: https://lore.kernel.org/r/20220208114728.e6b514cf4c85.Iffb575ca2a623d7859b542c33b2a507d01554251@changeid
1 parent f0a6fd1 commit bea2662

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/net/wireless/intel/iwlwifi/iwl-drv.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1707,6 +1707,8 @@ static void iwl_req_fw_callback(const struct firmware *ucode_raw, void *context)
17071707
out_unbind:
17081708
complete(&drv->request_firmware_complete);
17091709
device_release_driver(drv->trans->dev);
1710+
/* drv has just been freed by the release */
1711+
failure = false;
17101712
free:
17111713
if (failure)
17121714
iwl_dealloc_ucode(drv);

0 commit comments

Comments
 (0)