]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
firmware: stratix10-svc: fix memory leaks and list corruption bugs
authorTze Yee Ng <tze.yee.ng@altera.com>
Wed, 24 Jun 2026 10:06:35 +0000 (03:06 -0700)
committerDinh Nguyen <dinguyen@kernel.org>
Mon, 6 Jul 2026 23:07:39 +0000 (18:07 -0500)
commit9119ceb76e987c2ec2b549ea100e3268ce3a1c7c
tree06cd470a7a4f9e1be21bc2c902a1840860c12948
parentdc59e4fea9d83f03bad6bddf3fa2e52491777482
firmware: stratix10-svc: fix memory leaks and list corruption bugs

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@vger.kernel.org # 5.0+
Signed-off-by: Tze Yee Ng <tze.yee.ng@altera.com>
Signed-off-by: Dinh Nguyen <dinguyen@kernel.org>
drivers/firmware/stratix10-svc.c