Linux wireless drivers development
 help / color / mirror / Atom feed
* [PATCH] wifi: ath11k: Fix possible memory leak in ath11k_dp_srng_setup()
@ 2026-07-27 10:55 Abdun Nihaal
  2026-07-31  7:30 ` Baochen Qiang
  2026-07-31 21:40 ` Jeff Johnson
  0 siblings, 2 replies; 3+ messages in thread
From: Abdun Nihaal @ 2026-07-27 10:55 UTC (permalink / raw)
  To: jjohnson; +Cc: Abdun Nihaal, linux-wireless, ath11k, linux-kernel, stable

In ath11k_dp_srng_setup(), the memory allocated for
ring->vaddr_unaligned is not freed when ath11k_hal_srng_setup() fails.
Fix that by calling ath11k_dp_srng_cleanup() in that error path.

Fixes: d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices")
Cc: stable@vger.kernel.org
Signed-off-by: Abdun Nihaal <nihaal@cse.iitm.ac.in>
---
Compile tested only. Issue found using static analysis.

 drivers/net/wireless/ath/ath11k/dp.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/wireless/ath/ath11k/dp.c b/drivers/net/wireless/ath/ath11k/dp.c
index f389b97acbdd..c3a16da1cba7 100644
--- a/drivers/net/wireless/ath/ath11k/dp.c
+++ b/drivers/net/wireless/ath/ath11k/dp.c
@@ -324,6 +324,7 @@ int ath11k_dp_srng_setup(struct ath11k_base *ab, struct dp_srng *ring,
 
 	ret = ath11k_hal_srng_setup(ab, type, ring_num, mac_id, &params);
 	if (ret < 0) {
+		ath11k_dp_srng_cleanup(ab, ring);
 		ath11k_warn(ab, "failed to setup srng: %d ring_id %d\n",
 			    ret, ring_num);
 		return ret;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] wifi: ath11k: Fix possible memory leak in ath11k_dp_srng_setup()
  2026-07-27 10:55 [PATCH] wifi: ath11k: Fix possible memory leak in ath11k_dp_srng_setup() Abdun Nihaal
@ 2026-07-31  7:30 ` Baochen Qiang
  2026-07-31 21:40 ` Jeff Johnson
  1 sibling, 0 replies; 3+ messages in thread
From: Baochen Qiang @ 2026-07-31  7:30 UTC (permalink / raw)
  To: Abdun Nihaal, jjohnson; +Cc: linux-wireless, ath11k, linux-kernel, stable



On 7/27/2026 6:55 PM, Abdun Nihaal wrote:
> In ath11k_dp_srng_setup(), the memory allocated for
> ring->vaddr_unaligned is not freed when ath11k_hal_srng_setup() fails.
> Fix that by calling ath11k_dp_srng_cleanup() in that error path.
> 
> Fixes: d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices")
> Cc: stable@vger.kernel.org
> Signed-off-by: Abdun Nihaal <nihaal@cse.iitm.ac.in>
> ---
> Compile tested only. Issue found using static analysis.

this info is useful hence can be put in commit mesage

> 
>  drivers/net/wireless/ath/ath11k/dp.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/net/wireless/ath/ath11k/dp.c b/drivers/net/wireless/ath/ath11k/dp.c
> index f389b97acbdd..c3a16da1cba7 100644
> --- a/drivers/net/wireless/ath/ath11k/dp.c
> +++ b/drivers/net/wireless/ath/ath11k/dp.c
> @@ -324,6 +324,7 @@ int ath11k_dp_srng_setup(struct ath11k_base *ab, struct dp_srng *ring,
>  
>  	ret = ath11k_hal_srng_setup(ab, type, ring_num, mac_id, &params);
>  	if (ret < 0) {
> +		ath11k_dp_srng_cleanup(ab, ring);
>  		ath11k_warn(ab, "failed to setup srng: %d ring_id %d\n",
>  			    ret, ring_num);
>  		return ret;

Reviewed-by: Baochen Qiang <baochen.qiang@oss.qualcomm.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] wifi: ath11k: Fix possible memory leak in ath11k_dp_srng_setup()
  2026-07-27 10:55 [PATCH] wifi: ath11k: Fix possible memory leak in ath11k_dp_srng_setup() Abdun Nihaal
  2026-07-31  7:30 ` Baochen Qiang
@ 2026-07-31 21:40 ` Jeff Johnson
  1 sibling, 0 replies; 3+ messages in thread
From: Jeff Johnson @ 2026-07-31 21:40 UTC (permalink / raw)
  To: Abdun Nihaal, jjohnson; +Cc: linux-wireless, ath11k, linux-kernel, stable

On 7/27/2026 3:55 AM, Abdun Nihaal wrote:
> In ath11k_dp_srng_setup(), the memory allocated for
> ring->vaddr_unaligned is not freed when ath11k_hal_srng_setup() fails.
> Fix that by calling ath11k_dp_srng_cleanup() in that error path.

Did you find this on your own? Just want to make sure you are aware of:
https://docs.kernel.org/process/coding-assistants.html

FWIW my coding agent says this patch is correct but incomplete. There is a 2nd
leak, at the switch (type) default: case which returns -EINVAL without cleanup.

Care to incorporate a fix for that in a v2?
For that part you can add Assisted-by: Claude:claude-sonnet-4-6

/jeff
> 
> Fixes: d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices")
> Cc: stable@vger.kernel.org
> Signed-off-by: Abdun Nihaal <nihaal@cse.iitm.ac.in>
> ---
> Compile tested only. Issue found using static analysis.
> 
>  drivers/net/wireless/ath/ath11k/dp.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/net/wireless/ath/ath11k/dp.c b/drivers/net/wireless/ath/ath11k/dp.c
> index f389b97acbdd..c3a16da1cba7 100644
> --- a/drivers/net/wireless/ath/ath11k/dp.c
> +++ b/drivers/net/wireless/ath/ath11k/dp.c
> @@ -324,6 +324,7 @@ int ath11k_dp_srng_setup(struct ath11k_base *ab, struct dp_srng *ring,
>  
>  	ret = ath11k_hal_srng_setup(ab, type, ring_num, mac_id, &params);
>  	if (ret < 0) {
> +		ath11k_dp_srng_cleanup(ab, ring);
>  		ath11k_warn(ab, "failed to setup srng: %d ring_id %d\n",
>  			    ret, ring_num);
>  		return ret;


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-07-31 21:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-27 10:55 [PATCH] wifi: ath11k: Fix possible memory leak in ath11k_dp_srng_setup() Abdun Nihaal
2026-07-31  7:30 ` Baochen Qiang
2026-07-31 21:40 ` Jeff Johnson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox