[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <54D788E5.306@linutronix.de>
Date: Sun, 08 Feb 2015 17:03:49 +0100
From: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
To: David Dueck <davidcdueck@...glemail.com>,
linux-kernel@...r.kernel.org, gregkh@...uxfoundation.org
CC: balbi@...com, linux-usb@...r.kernel.org
Subject: Re: [PATCH] usb: phy: am335x-control: check return value of bus_find_device
On 02/08/2015 04:29 PM, David Dueck wrote:
> This fixes a potential null pointer dereference.
>
> Signed-off-by: David Dueck <davidcdueck@...glemail.com>
Acked-by: Sebastian Andrzej Siewior <bigeasy@...utronix.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists