Skip to content

Commit 4f7a077

Browse files
Miriam-Racheljmberg-intel
authored andcommitted
wifi: iwlwifi: mld: properly handle async notification in op mode start
From the moment that we have ALIVE, we can receive notification that are handled asynchronously. Some notifications (for example iwl_rfi_support_notif) requires an operational FW. So we need to make sure that they were handled in iwl_op_mode_mld_start before we stop the FW. Flush the async_handlers_wk there to achieve that. Also, if loading the FW in op mode start failed, we need to cancel these notifications, as they are from a dead FW. More than that, not doing so can cause us to access freed memory if async_handlers_wk is executed after ieee80211_free_hw is called. Fix this by canceling all async notifications if a failure occurred in init (after ALIVE). Fixes: d1e879e ("wifi: iwlwifi: add iwlmld sub-driver") Signed-off-by: Miri Korenblit <[email protected]> Link: https://patch.msgid.link/20250420095642.1a8579662437.Ifd77d9c1a29fdd278b0a7bfc2709dd5d5e5efdb1@changeid Signed-off-by: Johannes Berg <[email protected]>
1 parent 64dc5d5 commit 4f7a077

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

drivers/net/wireless/intel/iwlwifi/mld/fw.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -333,19 +333,22 @@ int iwl_mld_load_fw(struct iwl_mld *mld)
333333

334334
ret = iwl_trans_start_hw(mld->trans);
335335
if (ret)
336-
return ret;
336+
goto err;
337337

338338
ret = iwl_mld_run_fw_init_sequence(mld);
339339
if (ret)
340-
return ret;
340+
goto err;
341341

342342
ret = iwl_mld_init_mcc(mld);
343343
if (ret)
344-
return ret;
344+
goto err;
345345

346346
mld->fw_status.running = true;
347347

348348
return 0;
349+
err:
350+
iwl_mld_stop_fw(mld);
351+
return ret;
349352
}
350353

351354
void iwl_mld_stop_fw(struct iwl_mld *mld)
@@ -358,6 +361,10 @@ void iwl_mld_stop_fw(struct iwl_mld *mld)
358361

359362
iwl_trans_stop_device(mld->trans);
360363

364+
wiphy_work_cancel(mld->wiphy, &mld->async_handlers_wk);
365+
366+
iwl_mld_purge_async_handlers_list(mld);
367+
361368
mld->fw_status.running = false;
362369
}
363370

drivers/net/wireless/intel/iwlwifi/mld/mld.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,11 @@ iwl_op_mode_mld_start(struct iwl_trans *trans, const struct iwl_cfg *cfg,
417417
goto free_hw;
418418
}
419419

420+
/* We are about to stop the FW. Notifications may require an
421+
* operational FW, so handle them all here before we stop.
422+
*/
423+
wiphy_work_flush(mld->wiphy, &mld->async_handlers_wk);
424+
420425
iwl_mld_stop_fw(mld);
421426

422427
wiphy_unlock(mld->wiphy);

drivers/net/wireless/intel/iwlwifi/mld/mld.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -298,11 +298,6 @@ iwl_cleanup_mld(struct iwl_mld *mld)
298298
#endif
299299

300300
iwl_mld_low_latency_restart_cleanup(mld);
301-
302-
/* Empty the list of async notification handlers so we won't process
303-
* notifications from the dead fw after the reconfig flow.
304-
*/
305-
iwl_mld_purge_async_handlers_list(mld);
306301
}
307302

308303
enum iwl_power_scheme {

0 commit comments

Comments
 (0)