Skip to content

Commit

Permalink
wifi: ath12k: fix memory leak in ath12k_qmi_driver_event_work()
Browse files Browse the repository at this point in the history
[ Upstream commit 960412b ]

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>
Link: https://lore.kernel.org/r/20230315090632.15065-1-quic_rajson@quicinc.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Rajat Soni authored and gregkh committed May 24, 2023
1 parent bfa7323 commit a87f590
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/net/wireless/ath/ath12k/qmi.c
Expand Up @@ -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:
Expand Down Expand Up @@ -3032,6 +3032,8 @@ 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);
}
Expand Down

0 comments on commit a87f590

Please sign in to comment.