Skip to contentSkip to conversation

wifi: ath12k: fix memory leak in ath12k_qmi_driver_event_work()

PATCH In review Rajat Soni 2 participants 2 messages Mar 15, 2023 – Mar 22, 2023 Qualcomm ATH12K wireless driver

lore
Share & tools
lore

Rajat Soni

author
#0 lore raw

PATCH 1/1 wifi: ath12k: fix memory leak in ath12k_qmi_driver_event_work()

Currently the buffer pointed by event is not freed in case ATH12K_FLAG_UNREGISTERING bit is set, this causes memory leak.

Add a goto skip instead of return, to ensure event and all the list entries are freed properly.

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1

---
 drivers/net/wireless/ath/ath12k/qmi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath12k/qmi.c +2 -1
index 979a63f2e2ab..4beb9ef23d08 100644
@@ -2991,7 +2991,7 @@ static void ath12k_qmi_driver_event_work(struct work_struct *work)
 		spin_unlock(&qmi->event_lock);
 
 		if (test_bit(ATH12K_FLAG_UNREGISTERING, &ab->dev_flags))
-			return;
+			goto skip;
 
 		switch (event->type) {
 		case ATH12K_QMI_EVENT_SERVER_ARRIVE:
@@ -3032,6 +3032,7 @@ static void ath12k_qmi_driver_event_work(struct work_struct *work)
 			ath12k_warn(ab, "invalid event type: %d", event->type);
 			break;
 		}
+skip:
 		kfree(event);
 		spin_lock(&qmi->event_lock);
 	}

base-commit: 3fa9da4001890def44801dd56d5fbc134689be28

Signature · 7 lines
2.17.1


-- 
ath12k mailing list
[email protected]
https://lists.infradead.org/mailman/listinfo/ath12k
#1 lore raw
Quoted 10 lines · Rajat Soni

Currently the buffer pointed by event is not freed in case ATH12K_FLAG_UNREGISTERING bit is set, this causes memory leak.

Add a goto skip instead of return, to ensure event and all the list entries are freed properly.

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1

Patch applied to ath-next branch of ath.git, thanks.

960412bee0ea wifi: ath12k: fix memory leak in ath12k_qmi_driver_event_work()

Signature · 9 lines
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


-- 
ath12k mailing list
[email protected]
https://lists.infradead.org/mailman/listinfo/ath12k