mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Richard Leitner <richard.leitner@skidata.com>
To: Aditya Pakki <pakki001@umn.edu>
Cc: <kjlu@umn.edu>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	<linux-usb@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] usb: usb251xb: fix to avoid potential NULL pointer dereference
Date: Tue, 19 Mar 2019 14:11:23 +0100	[thread overview]
Message-ID: <3579fc19-dde7-968b-3918-39f1cc4ee3bc@skidata.com> (raw)
In-Reply-To: <20190318235605.11055-1-pakki001@umn.edu>

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@umn.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);
> 

      reply	other threads:[~2019-03-19 13:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-18 23:56 Aditya Pakki
2019-03-19 13:11 ` Richard Leitner [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=3579fc19-dde7-968b-3918-39f1cc4ee3bc@skidata.com \
    --to=richard.leitner@skidata.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kjlu@umn.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=pakki001@umn.edu \
    /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®