From: David Dueck <davidcdueck@googlemail.com>
To: linux-kernel@vger.kernel.org
Cc: bigeasy@linutronix.de, balbi@ti.com, gregkh@linuxfoundation.org,
linux-usb@vger.kernel.org
Subject: [PATCH] usb: phy: am335x-control: check return value of bus_find_device
Date: Sun, 8 Feb 2015 16:29:30 +0100 [thread overview]
Message-ID: <1423409370-4769-1-git-send-email-davidcdueck@googlemail.com> (raw)
This fixes a potential null pointer dereference.
Signed-off-by: David Dueck <davidcdueck@googlemail.com>
---
drivers/usb/phy/phy-am335x-control.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/usb/phy/phy-am335x-control.c b/drivers/usb/phy/phy-am335x-control.c
index 403fab7..7b3035f 100644
--- a/drivers/usb/phy/phy-am335x-control.c
+++ b/drivers/usb/phy/phy-am335x-control.c
@@ -126,6 +126,9 @@ struct phy_control *am335x_get_phy_control(struct device *dev)
return NULL;
dev = bus_find_device(&platform_bus_type, NULL, node, match);
+ if (!dev)
+ return NULL;
+
ctrl_usb = dev_get_drvdata(dev);
if (!ctrl_usb)
return NULL;
--
2.2.2
next reply other threads:[~2015-02-08 15:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-08 15:29 David Dueck [this message]
2015-02-08 16:03 ` Sebastian Andrzej Siewior
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=1423409370-4769-1-git-send-email-davidcdueck@googlemail.com \
--to=davidcdueck@googlemail.com \
--cc=balbi@ti.com \
--cc=bigeasy@linutronix.de \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.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
all inboxes | Powered by JetHome®