Re: [PATCH v2] firmware: stratix10-svc: fix memory leaks and list corruption bugs
From: Dinh Nguyen
Date: Wed Jun 24 2026 - 01:22:56 EST
On 6/23/26 22:47, tze.yee.ng@xxxxxxxxxx wrote:
From: Tze Yee Ng <tze.yee.ng@xxxxxxxxxx>
Fix a memory leak when gen_pool_alloc() fails by freeing pmem on the error
path. Switch pmem allocation from devm_kzalloc() to kzalloc() with
explicit kfree() in the free path to match its list-managed lifetime.
Remove the erroneous list_del(&svc_data_mem) which corrupted the list head
on failed lookups.
Fixes: 7ca5ce896524 ("firmware: add Intel Stratix10 service layer driver")
Cc: stable@xxxxxxxxxxxxxxx # 5.0+
Remove blank line.
Signed-off-by: Tze Yee Ng <tze.yee.ng@xxxxxxxxxx>
---
Changes in v2:
- Remove if (!chan || !kaddr) early return from stratix10_svc_free_memory()
per review; failed lookup is handled by dropping list_del(&svc_data_mem).
- Add Cc: stable@xxxxxxxxxxxxxxx # 5.0+.
- Minor commit message cleanup (lifetime spelling, subject line).
---
Dinh