Skip to content

Commit 41f563a

Browse files
Shang XiaoJinghdeller
authored andcommitted
parisc: led: Fix potential null-ptr-deref in start_task()
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: 3499495 ("[PARISC] Use work queue in LED/LCD driver instead of tasklet.") Signed-off-by: Shang XiaoJing <[email protected]> Signed-off-by: Helge Deller <[email protected]> Cc: <[email protected]>
1 parent 1bc5434 commit 41f563a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/parisc/led.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,9 @@ static int start_task(void)
137137

138138
/* Create the work queue and queue the LED task */
139139
led_wq = create_singlethread_workqueue("led_wq");
140+
if (!led_wq)
141+
return -ENOMEM;
142+
140143
queue_delayed_work(led_wq, &led_task, 0);
141144

142145
return 0;

0 commit comments

Comments
 (0)