From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: David Dueck <davidcdueck@googlemail.com>,
linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org
Cc: balbi@ti.com, linux-usb@vger.kernel.org
Subject: Re: [PATCH] usb: phy: am335x-control: check return value of bus_find_device
Date: Sun, 08 Feb 2015 17:03:49 +0100 [thread overview]
Message-ID: <54D788E5.306@linutronix.de> (raw)
In-Reply-To: <1423409370-4769-1-git-send-email-davidcdueck@googlemail.com>
On 02/08/2015 04:29 PM, David Dueck wrote:
> This fixes a potential null pointer dereference.
>
> Signed-off-by: David Dueck <davidcdueck@googlemail.com>
Acked-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Fixes: d4332013919a ("driver core: dev_get_drvdata: Don't check for NULL
dev")
Greg, this is a regression since d43320139 ("driver core:
dev_get_drvdata: Don't check for NULL dev"). I didn't check for NULL
after bus_find_device() because I knew that dev_get_drvdata() will do
it.
> ---
> 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;
>
Sebastian
prev parent reply other threads:[~2015-02-08 16:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-08 15:29 David Dueck
2015-02-08 16:03 ` Sebastian Andrzej Siewior [this message]
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=54D788E5.306@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=balbi@ti.com \
--cc=davidcdueck@googlemail.com \
--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®