mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 09:36:22 +02:00
powerpc/pseries: fix memory leak on krealloc failure in papr_init
When krealloc() fails, free the original esi_buf before returning to
avoid a memory leak.
Fixes: 3c14b73454 ("powerpc/pseries: Interface to represent PAPR firmware attributes")
Cc: stable@vger.kernel.org
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Link: https://patch.msgid.link/20260614142356.658212-2-thorsten.blum@linux.dev
This commit is contained in:
parent
d610d3ab18
commit
bd83c98b98
|
|
@ -271,11 +271,9 @@ static int __init papr_init(void)
|
|||
esi_buf_size = ESI_HDR_SIZE + (CURR_MAX_ESI_ATTRS * max_esi_attrs);
|
||||
|
||||
temp_esi_buf = krealloc(esi_buf, esi_buf_size, GFP_KERNEL);
|
||||
if (temp_esi_buf)
|
||||
esi_buf = temp_esi_buf;
|
||||
else
|
||||
return -ENOMEM;
|
||||
|
||||
if (!temp_esi_buf)
|
||||
goto out_free_esi_buf;
|
||||
esi_buf = temp_esi_buf;
|
||||
goto retry;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user