PM / wakeup: Skip wakeup_source_sysfs_remove if device is not added
Subsystems (5)
PATCH 1/1 PM / wakeup: Skip wakeup_source_sysfs_remove if device is not added
Skip wakeup_source_sysfs_remove(), to fix null pinter access of ws->dev, if wakeup source is unregistered before wakeup class is registered from device_add().
Fixes 2ca3d1ecb8c4 ("PM / wakeup: Register wakeup class kobj after device is added")
Signed-off-by Neeraj Upadhyay <[email protected]>
--- drivers/base/power/wakeup.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/base/power/wakeup.c +2 -1
@@ -241,7 +241,8 @@ void wakeup_source_unregister(struct wakeup_source *ws) {if (ws) {wakeup_source_remove (ws); -wakeup_source_sysfs_remove (ws); +if (ws->dev) +wakeup_source_sysfs_remove (ws);wakeup_source_destroy (ws); } }
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation
Quoted 16 lines · CET Neeraj Upadhyay
Skip
wakeup_source_sysfs_remove(), to fix null pinter access ofws->dev, if wakeup source is unregistered before wakeup class is registered fromdevice_add().Fixes 2ca3d1ecb8c4 ("PM / wakeup: Register wakeup class kobj after device is added")Signed-off-by Neeraj Upadhyay <[email protected]>--- drivers/base/power/wakeup.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/base/power/wakeup.c +0
-0
drivers/base/power/wakeup.c void wakeup_source_unregister(struct wakeup_source *ws) · line 248
Quoted 9 lines
drivers/base/power/wakeup.c +2
-1@@ -241,7 +241,8 @@ void wakeup_source_unregister(struct wakeup_source *ws) {if (ws) {wakeup_source_remove (ws); -wakeup_source_sysfs_remove (ws); +if (ws->dev) +wakeup_source_sysfs_remove (ws);wakeup_source_destroy (ws); } }
Applied (with some minor changes) as 5.7 material, thanks!