diff options
author | Shang XiaoJing <shangxiaojing@huawei.com> | 2022-11-17 10:45:14 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-01-07 12:07:37 +0100 |
commit | c6db0c32f39684c89c97bc1ba1c9c4249ca09e48 (patch) | |
tree | 64c23596491de6e9e11fb197e1b8188c02e0437a | |
parent | fbac2c5be9fd7893eba6c36e86eec1f49e95e9c6 (diff) | |
download | linux-stable-c6db0c32f39684c89c97bc1ba1c9c4249ca09e48.tar.gz linux-stable-c6db0c32f39684c89c97bc1ba1c9c4249ca09e48.tar.bz2 linux-stable-c6db0c32f39684c89c97bc1ba1c9c4249ca09e48.zip |
parisc: led: Fix potential null-ptr-deref in start_task()
commit 41f563ab3c33698bdfc3403c7c2e6c94e73681e4 upstream.
start_task() calls create_singlethread_workqueue() and not checked the
ret value, which may return NULL. And a null-ptr-deref may happen:
start_task()
create_singlethread_workqueue() # failed, led_wq is NULL
queue_delayed_work()
queue_delayed_work_on()
__queue_delayed_work() # warning here, but continue
__queue_work() # access wq->flags, null-ptr-deref
Check the ret value and return -ENOMEM if it is NULL.
Fixes: 3499495205a6 ("[PARISC] Use work queue in LED/LCD driver instead of tasklet.")
Signed-off-by: Shang XiaoJing <shangxiaojing@huawei.com>
Signed-off-by: Helge Deller <deller@gmx.de>
Cc: <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/parisc/led.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/parisc/led.c b/drivers/parisc/led.c index 3a91e06926ad..e800e83fa225 100644 --- a/drivers/parisc/led.c +++ b/drivers/parisc/led.c @@ -141,6 +141,9 @@ static int start_task(void) /* Create the work queue and queue the LED task */ led_wq = create_singlethread_workqueue("led_wq"); + if (!led_wq) + return -ENOMEM; + queue_delayed_work(led_wq, &led_task, 0); return 0; |