From: "Pali Rohár" <pali.rohar@gmail.com>
To: Sebastian Reichel <sre@kernel.org>,
Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>,
David Woodhouse <dwmw2@infradead.org>
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
"Dan Carpenter" <dan.carpenter@oracle.com>,
"Pali Rohár" <pali.rohar@gmail.com>
Subject: [PATCH] bq2415x_charger: Fix null pointer dereference
Date: Mon, 21 Sep 2015 16:58:20 +0200 [thread overview]
Message-ID: <1442847500-22435-1-git-send-email-pali.rohar@gmail.com> (raw)
Commit b68c3161430a (bq2415x_charger: Allow to load and use driver even if
notify device is not registered yet) introduced null pointer dereference in
case bq is NULL. This patch fixes it.
Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
---
drivers/power/bq2415x_charger.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/power/bq2415x_charger.c b/drivers/power/bq2415x_charger.c
index ec212b5..4afd768 100644
--- a/drivers/power/bq2415x_charger.c
+++ b/drivers/power/bq2415x_charger.c
@@ -1704,7 +1704,7 @@ error_4:
error_3:
bq2415x_power_supply_exit(bq);
error_2:
- if (bq->notify_node)
+ if (bq && bq->notify_node)
of_node_put(bq->notify_node);
kfree(name);
error_1:
--
1.7.10.4
next reply other threads:[~2015-09-21 14:58 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-21 14:58 Pali Rohár [this message]
2015-09-23 17:04 ` [PATCH] bq2415x_charger: Fix null pointer dereference Sebastian Reichel
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=1442847500-22435-1-git-send-email-pali.rohar@gmail.com \
--to=pali.rohar@gmail.com \
--cc=dan.carpenter@oracle.com \
--cc=dbaryshkov@gmail.com \
--cc=dwmw2@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=sre@kernel.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;
as well as URLs for NNTP newsgroup(s).