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

From: Dinh Nguyen

Date: Mon Jul 06 2026 - 19:11:32 EST




On 6/24/26 05:06, 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+
Signed-off-by: Tze Yee Ng <tze.yee.ng@xxxxxxxxxx>
---
Changes in v3:
- Remove blank line before Signed-off-by.
- No code changes.

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).
---
drivers/firmware/stratix10-svc.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/firmware/stratix10-svc.c b/drivers/firmware/stratix10-svc.c
index 00e134e663c8..ccf57dfd9a2d 100644
--- a/drivers/firmware/stratix10-svc.c
+++ b/drivers/firmware/stratix10-svc.c

Applied!

Thanks,
Dinh