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:
6f22b18
)
reset: bail if try_module_get() fails
author
Philipp Zabel
<p.zabel@pengutronix.de>
Mon, 7 Jun 2021 08:26:15 +0000
(10:26 +0200)
committer
Greg Kroah-Hartman
<gregkh@linuxfoundation.org>
Tue, 20 Jul 2021 14:17:55 +0000
(16:17 +0200)
[ Upstream commit
4fb26fb83f0def3d39c14e268bcd4003aae8fade
]
Abort instead of returning a new reset control for a reset controller
device that is going to have its module unloaded.
Reported-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Fixes:
61fc41317666
("reset: Add reset controller API")
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link:
https://lore.kernel.org/r/20210607082615.15160-1-p.zabel@pengutronix.de
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/reset/core.c
patch
|
blob
|
blame
|
history
diff --git
a/drivers/reset/core.c
b/drivers/reset/core.c
index 7e0a14211c88a5e956505dc8364b543a908ff907..d941fb4050bbbf6f69dd8082ebc1b45a990e65ed 100644
(file)
--- a/
drivers/reset/core.c
+++ b/
drivers/reset/core.c
@@
-398,7
+398,10
@@
static struct reset_control *__reset_control_get_internal(
if (!rstc)
return ERR_PTR(-ENOMEM);
- try_module_get(rcdev->owner);
+ if (!try_module_get(rcdev->owner)) {
+ kfree(rstc);
+ return ERR_PTR(-ENODEV);
+ }
rstc->rcdev = rcdev;
list_add(&rstc->list, &rcdev->reset_control_head);