diff mbox series

iwlegacy/4965: Cancel deferred work on device init failure

Message ID 20250304031603.1989-1-vulab@iscas.ac.cn (mailing list archive)
State New
Delegated to: Johannes Berg
Headers show
Series iwlegacy/4965: Cancel deferred work on device init failure | expand

Checks

Context Check Description
jmberg/fixes_present success Fixes tag not required for -next series
jmberg/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
jmberg/tree_selection success Guessed tree name to be wireless-next
jmberg/ynl success Generated files up to date; no warnings/errors; no diff in generated;
jmberg/build_32bit success Errors and warnings before: 0 this patch: 0
jmberg/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
jmberg/build_clang success Errors and warnings before: 0 this patch: 0
jmberg/build_clang_rust success No Rust files in patch. Skipping build
jmberg/build_tools success No tools touched, skip
jmberg/check_selftest success No net selftest shell script
jmberg/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
jmberg/deprecated_api success None detected
jmberg/header_inline success No static functions without inline keyword in header files
jmberg/kdoc success Errors and warnings before: 0 this patch: 0
jmberg/source_inline success Was 0 now: 0
jmberg/verify_fixes success No Fixes tag
jmberg/verify_signedoff success Signed-off-by tag matches author and committer

Commit Message

Wentao Liang March 4, 2025, 3:16 a.m. UTC
In __il4965_up(), deferred work is not canceled in time when device
initialization fails. This is harmless if the device has not started.
However, in il4965_bg_restart(), if the device remains operational
in any state other than S_FW_ERROR or S_EXIT_PENDING, a dereference
operation needs to be performed when __il4965_up() fails.

Add il4965_cancel_deferred_work() to the failure path of
__il4965_up() to prevent potential errors. Even if the current code
does not exhibit the described issues, adding this change can prevent
future problems at minimal cost, improving the robustness of the code.

Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
 drivers/net/wireless/intel/iwlegacy/4965-mac.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/drivers/net/wireless/intel/iwlegacy/4965-mac.c b/drivers/net/wireless/intel/iwlegacy/4965-mac.c
index 05c4af41bdb9..3b21bd79f3a9 100644
--- a/drivers/net/wireless/intel/iwlegacy/4965-mac.c
+++ b/drivers/net/wireless/intel/iwlegacy/4965-mac.c
@@ -5591,6 +5591,8 @@  __il4965_up(struct il_priv *il)
 	__il4965_down(il);
 	clear_bit(S_EXIT_PENDING, &il->status);
 
+	il4965_cancel_deferred_work(il);
+
 	/* tried to restart and config the device for as long as our
 	 * patience could withstand */
 	IL_ERR("Unable to initialize device after %d attempts.\n", i);