Skip to contentSkip to conversation

wifi: ath9k: avoid device access after async firmware request

PATCH In review Yousef Alhouseen 2 participants 3 messages Jun 28 – Jun 29

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 wifi: ath9k: avoid device access after async firmware request

request_firmware_nowait() may invoke the callback before the requesting context resumes. When a firmware lookup fails, the callback starts the next fallback request. That nested request can exhaust the fallback list, complete fw_done, and let disconnect free hif_dev before the parent request returns.

The parent then dereferences hif_dev only to print a successful-request message. Remove that post-request access so completion cannot leave an older callback using the freed device state.

Fixes e904cf6fe230 ("ath9k_htc: introduce support for different fw versions")
Reported-by [email protected]
---
 drivers/net/wireless/ath/ath9k/hif_usb.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/net/wireless/ath/ath9k/hif_usb.c +0 -3
index 515267f48d80..aaf924cb8860 100644
@@ -1222,9 +1222,6 @@ static int ath9k_hif_request_firmware(struct hif_device_usb *hif_dev,
 		return ret;
 	}
 
-	dev_info(&hif_dev->udev->dev, "ath9k_htc: Firmware %s requested\n",
-		 hif_dev->fw_name);
-
 	return ret;
 }
 
Signature · 1 line
2.54.0
#1 lore raw
Quoted 10 lines · Yousef Alhouseen

request_firmware_nowait() may invoke the callback before the requesting context resumes. When a firmware lookup fails, the callback starts the next fallback request. That nested request can exhaust the fallback list, complete fw_done, and let disconnect free hif_dev before the parent request returns.

The parent then dereferences hif_dev only to print a successful-request message. Remove that post-request access so completion cannot leave an older callback using the freed device state.

Quoted 5 lines
Fixes e904cf6fe230 ("ath9k_htc: introduce support for different fw versions")
Reported-by [email protected]

An identical patch was already submitted and is currently pending:
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/

-Toke

#2 lore raw

Thanks for the pointer. I missed the pending patch; please drop mine.

Thanks,
Yousef

Quoted 22 lines · Toke Høiland-Jørgensen
Quoted 10 lines · Yousef Alhouseen

request_firmware_nowait() may invoke the callback before the requesting context resumes. When a firmware lookup fails, the callback starts the next fallback request. That nested request can exhaust the fallback list, complete fw_done, and let disconnect free hif_dev before the parent request returns.

The parent then dereferences hif_dev only to print a successful-request message. Remove that post-request access so completion cannot leave an older callback using the freed device state.

Quoted 5 lines
Fixes e904cf6fe230 ("ath9k_htc: introduce support for different fw versions")
Reported-by [email protected]

An identical patch was already submitted and is currently pending:
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/

-Toke