[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <3579fc19-dde7-968b-3918-39f1cc4ee3bc@skidata.com>
Date: Tue, 19 Mar 2019 14:11:23 +0100
From: Richard Leitner <richard.leitner@...data.com>
To: Aditya Pakki <pakki001@....edu>
CC: <kjlu@....edu>, Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
<linux-usb@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] usb: usb251xb: fix to avoid potential NULL pointer
dereference
On 19/03/2019 00:56, Aditya Pakki wrote:
> of_match_device in usb251xb_probe can fail and returns a NULL pointer.
> The patch avoids a potential NULL pointer dereference in this scenario.
>
> Signed-off-by: Aditya Pakki <pakki001@....edu>
> ---
> drivers/usb/misc/usb251xb.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/usb/misc/usb251xb.c b/drivers/usb/misc/usb251xb.c
> index 4d72b7d1d383..fe5266dc8864 100644
> --- a/drivers/usb/misc/usb251xb.c
> +++ b/drivers/usb/misc/usb251xb.c
> @@ -612,6 +612,8 @@ static int usb251xb_probe(struct usb251xb *hub)
> dev);
> int err;
>
> + if (!of_id)
> + return -ENODEV;
Hi Aditya,
thanks for finding this issue!
Nonetheless I'd prefer to change this to not return here but rather do
something like:
if (np && of_id) {
So we still may bring up the hub in its default config in scenarios
without dt/of...
Any comments/objections on that?
regards;Richard.L
> if (np) {
> err = usb251xb_get_ofdata(hub,
> (struct usb251xb_data *)of_id->data);
>
Powered by blists - more mailing lists