Re: [PATCH] wifi: ath11k: Fix possible memory leak in ath11k_dp_srng_setup()

Abdun Nihaal <[email protected]> Sat, 1 Aug 2026 17:08:38 +0530
Newsgroups org.infradead.lists.ath11k,org.kernel.vger.linux-kernel,org.kernel.vger.linux-wireless,org.kernel.vger.stable
Message-ID <l2m3df76j6tzdshgoecqx2fn3b2kzjsytqsxq6mpououga2wjn@zjxksj4z6iov>
On Fri, Jul 31, 2026 at 02:40:37PM -0700, Jeff Johnson wrote:
> 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

I used a prototype static analysis tool that I'm building using the LLVM
compiler infrastructure, to detect this memory leak issue.
Didn't use LLMs, that's why didn't include the Assisted-by tag.

> 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

I didn't find any calls to ath11k_dp_srng_setup() that passes any
hal_ring_type other than the handled ones. That's why I left the default
case as infeasible. But anyways, to be safe, I'll add a free in the
default case as well, and send a v2.

Regards,
Nihaal