Skip to content

Commit 87de659

Browse files
Neeraj Upadhyayrafaeljw
authored andcommitted
PM: sleep: wakeup: Skip wakeup_source_sysfs_remove() if device is not there
Skip wakeup_source_sysfs_remove() to fix a NULL pinter dereference via ws->dev, if the wakeup source is unregistered before registering the wakeup class from device_add(). Fixes: 2ca3d1e ("PM / wakeup: Register wakeup class kobj after device is added") Signed-off-by: Neeraj Upadhyay <[email protected]> Cc: 5.4+ <[email protected]> # 5.4+ [ rjw: Subject & changelog, white space ] Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent fba616a commit 87de659

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/base/power/wakeup.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,9 @@ void wakeup_source_unregister(struct wakeup_source *ws)
244244
{
245245
if (ws) {
246246
wakeup_source_remove(ws);
247-
wakeup_source_sysfs_remove(ws);
247+
if (ws->dev)
248+
wakeup_source_sysfs_remove(ws);
249+
248250
wakeup_source_destroy(ws);
249251
}
250252
}

0 commit comments

Comments
 (0)