* [PATCH] wifi: ath12k: fix memory leak in ath12k_qmi_driver_event_work()
@ 2023-03-15 9:06 Rajat Soni
2023-03-22 10:05 ` Kalle Valo
0 siblings, 1 reply; 2+ messages in thread
From: Rajat Soni @ 2023-03-15 9:06 UTC (permalink / raw)
To: ath12k; +Cc: linux-wireless, 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
Signed-off-by: Rajat Soni <quic_rajson@quicinc.com>
---
drivers/net/wireless/ath/ath12k/qmi.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/ath/ath12k/qmi.c b/drivers/net/wireless/ath/ath12k/qmi.c
index 979a63f2e2ab..4beb9ef23d08 100644
--- a/drivers/net/wireless/ath/ath12k/qmi.c
+++ b/drivers/net/wireless/ath/ath12k/qmi.c
@@ -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
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] wifi: ath12k: fix memory leak in ath12k_qmi_driver_event_work()
2023-03-15 9:06 [PATCH] wifi: ath12k: fix memory leak in ath12k_qmi_driver_event_work() Rajat Soni
@ 2023-03-22 10:05 ` Kalle Valo
0 siblings, 0 replies; 2+ messages in thread
From: Kalle Valo @ 2023-03-22 10:05 UTC (permalink / raw)
To: Rajat Soni; +Cc: ath12k, linux-wireless, Rajat Soni
Rajat Soni <quic_rajson@quicinc.com> wrote:
> 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
>
> Signed-off-by: Rajat Soni <quic_rajson@quicinc.com>
> Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Patch applied to ath-next branch of ath.git, thanks.
960412bee0ea wifi: ath12k: fix memory leak in ath12k_qmi_driver_event_work()
--
https://patchwork.kernel.org/project/linux-wireless/patch/20230315090632.15065-1-quic_rajson@quicinc.com/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-03-22 10:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-15 9:06 [PATCH] wifi: ath12k: fix memory leak in ath12k_qmi_driver_event_work() Rajat Soni
2023-03-22 10:05 ` Kalle Valo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).