mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-11-09 19:10:45 +01:00
pstore/ram: Fix error-path memory leak in persistent_ram_new() callers
For callers that allocated a label for persistent_ram_new(), if the call
fails, they must clean up the allocation.
Suggested-by: Navid Emamdoost <[email protected]>
Fixes: 1227daa43b ("pstore/ram: Clarify resource reservation labels")
Cc: [email protected]
Link: https://lore.kernel.org/lkml/[email protected]
Signed-off-by: Kees Cook <[email protected]>
This commit is contained in:
1 parent
d1eef1c619
commit
8df955a32a
1 file changed
+2
@@ -577,6 +577,7 @@ static int ramoops_init_przs(const char *name,
|
||||
dev_err(dev, "failed to request %s mem region (0x%zx@0x%llx): %d\n",
|
||||
name, record_size,
|
||||
(unsigned long long)*paddr, err);
|
||||
kfree(label);
|
||||
|
||||
while (i > 0) {
|
||||
i--;
|
||||
@@ -622,6 +623,7 @@ static int ramoops_init_prz(const char *name,
|
||||
|
||||
dev_err(dev, "failed to request %s mem region (0x%zx@0x%llx): %d\n",
|
||||
name, sz, (unsigned long long)*paddr, err);
|
||||
kfree(label);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user