projects
/
GitHub
/
LineageOS
/
android_kernel_motorola_exynos9610.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
62d719d
)
x86/pmem: Fix platform-device leak in error path
author
Johan Hovold
<johan@kernel.org>
Mon, 20 Jun 2022 14:07:23 +0000
(16:07 +0200)
committer
Greg Kroah-Hartman
<gregkh@linuxfoundation.org>
Thu, 25 Aug 2022 09:11:15 +0000
(11:11 +0200)
[ Upstream commit
229e73d46994f15314f58b2d39bf952111d89193
]
Make sure to free the platform device in the unlikely event that
registration fails.
Fixes:
7a67832c7e44
("libnvdimm, e820: make CONFIG_X86_PMEM_LEGACY a tristate option")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link:
https://lore.kernel.org/r/20220620140723.9810-1-johan@kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/x86/kernel/pmem.c
patch
|
blob
|
blame
|
history
diff --git
a/arch/x86/kernel/pmem.c
b/arch/x86/kernel/pmem.c
index 3fe6900678026e2cee5eb721dbba3eaae84bbb81..ada7c077ec2f61003c25af0520208600886a4a1b 100644
(file)
--- a/
arch/x86/kernel/pmem.c
+++ b/
arch/x86/kernel/pmem.c
@@
-27,6
+27,11
@@
static __init int register_e820_pmem(void)
* simply here to trigger the module to load on demand.
*/
pdev = platform_device_alloc("e820_pmem", -1);
- return platform_device_add(pdev);
+
+ rc = platform_device_add(pdev);
+ if (rc)
+ platform_device_put(pdev);
+
+ return rc;
}
device_initcall(register_e820_pmem);