Re: [PATCH 5.15.y] firmware: stratix10-svc: fix memory leaks and list corruption bugs

"NG, TZE YEE" <[email protected]> Mon, 3 Aug 2026 12:16:43 +0000
Newsgroups org.kernel.vger.stable
Message-ID <[email protected]>
On 31/7/2026 10:39 am, Sasha Levin wrote:
> [You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
> 
> On Wed, Jul 29, 2026 at 07:36:04PM -0700, [email protected] wrote:
>> -      pmem = devm_kzalloc(chan->ctrl->dev, sizeof(*pmem), GFP_KERNEL);
>> +      pmem = kzalloc_obj(*pmem);
> 
> Did you even build test this?
> 
>> @@ -944,16 +946,17 @@ void stratix10_svc_free_memory(struct stratix10_svc_chan *chan, void *kaddr)
>> {
>>        struct stratix10_svc_data_mem *pmem;
>>
>> +      guard(mutex)(&svc_mem_lock);
>> +
>>        list_for_each_entry(pmem, &svc_data_mem, node)
> 
> This wouldn't work either, right?
> 
> --
> Thanks,
> Sasha

Hi Sasha,

Thanks for the review. You are right — this backport is incorrect as 
submitted.

kzalloc_obj() is not available on these stable kernels, and the 
guard(mutex)(&svc_mem_lock) line was accidentally introduced during 
rebase; it is not part of the upstream fix and should not be in this 
backport.

The same issues are present in the 5.10.y backport as well. I will send 
a v2 patches for both 5.15.y and 5.10.y that:
   - replaces kzalloc_obj() with kzalloc(sizeof(*pmem), GFP_KERNEL)
   - drops the stray guard(mutex)(&svc_mem_lock)

Sorry for the noise.

Thanks,
Tze Yee