From: Neeraj Upadhyay <neeraju@codeaurora.org>
To: rjw@rjwysocki.net, pavel@ucw.cz, len.brown@intel.com,
gregkh@linuxfoundation.org, swboyd@chromium.org
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
irgeorgiev@codeaurora.org, linux-arm-msm@vger.kernel.org,
Neeraj Upadhyay <neeraju@codeaurora.org>
Subject: [PATCH] PM / wakeup: Skip wakeup_source_sysfs_remove if device is not added
Date: Mon, 23 Mar 2020 10:38:51 +0530 [thread overview]
Message-ID: <1584940131-1591-1-git-send-email-neeraju@codeaurora.org> (raw)
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 <neeraju@codeaurora.org>
---
drivers/base/power/wakeup.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/base/power/wakeup.c b/drivers/base/power/wakeup.c
index 27f3e60..f8f8c0a 100644
--- a/drivers/base/power/wakeup.c
+++ b/drivers/base/power/wakeup.c
@@ -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);
}
}
--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a
member of the Code Aurora Forum, hosted by The Linux Foundation
next reply other threads:[~2020-03-23 5:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-23 5:08 Neeraj Upadhyay [this message]
2020-03-25 10:37 ` Rafael J. Wysocki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1584940131-1591-1-git-send-email-neeraju@codeaurora.org \
--to=neeraju@codeaurora.org \
--cc=gregkh@linuxfoundation.org \
--cc=irgeorgiev@codeaurora.org \
--cc=len.brown@intel.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=pavel@ucw.cz \
--cc=rjw@rjwysocki.net \
--cc=swboyd@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome