[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190204220952.30761-4-TheSven73@googlemail.com>
Date: Mon, 4 Feb 2019 17:09:52 -0500
From: Sven Van Asbroeck <thesven73@...il.com>
To: Tejun Heo <tj@...nel.org>
Cc: Lai Jiangshan <jiangshanlai@...il.com>,
linux-kernel@...r.kernel.org, Sebastian Reichel <sre@...nel.org>,
Dmitry Torokhov <dmitry.torokhov@...il.com>,
Kees Cook <keescook@...omium.org>
Subject: [RFC v1 3/3] cap11xx: fix potential user-after-free on module unload
The work which is scheduled by led_classdev->brightness_set() is
potentially left pending or running until after the driver module
is unloaded.
Fix by using resource-controlled version of INIT_WORK().
Signed-off-by: Sven Van Asbroeck <TheSven73@...glemail.com>
---
drivers/input/keyboard/cap11xx.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/input/keyboard/cap11xx.c b/drivers/input/keyboard/cap11xx.c
index 312916f99597..a92dd8ee9ed7 100644
--- a/drivers/input/keyboard/cap11xx.c
+++ b/drivers/input/keyboard/cap11xx.c
@@ -312,7 +312,11 @@ static int cap11xx_init_leds(struct device *dev,
led->reg = reg;
led->priv = priv;
- INIT_WORK(&led->work, cap11xx_led_work);
+ error = devm_init_work(dev, &led->work, cap11xx_led_work);
+ if (error) {
+ of_node_put(child);
+ return error;
+ }
error = devm_led_classdev_register(dev, &led->cdev);
if (error) {
--
2.17.1
Powered by blists - more mailing lists