All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anatolij Gustschin <agust@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] usb: check udev before dereferencing
Date: Sat, 12 Nov 2016 19:10:28 +0100	[thread overview]
Message-ID: <20161112191028.6acc5536@crub> (raw)
In-Reply-To: <7b8b75cd-4d6f-3ff0-6fb5-649252e5bc8c@denx.de>

On Sat, 12 Nov 2016 10:36:42 +0100
Marek Vasut marex at denx.de wrote:
...
> >  		udev = dev_get_parent_priv(child);
> > +		if (!udev)
> > +			continue;  
> 
> I don't quite understand the problem from the patch description, but
> shouldn't all the return values from dev_get_parent_priv() be checked
> this way , not just these two ?

The problem is that when dereferencing NULL udev we later access
some random address (e.g. when accessing dev->dev->parent in
usb_show_tree_graph()). dev->dev pointer is random DRAM data there,
when dereferencing it, data abort happens when random address
is outside of valid address range.

Probably we should check elsewhere, at least where it might
return NULL.

> 
> Why does dev_get_parent_priv() return NULL here ?

it returns NULL because the dev->parent_priv is not allocated for
usb_mass_storage.lun0 device. I do not know the reason why.

--
Anatolij

  reply	other threads:[~2016-11-12 18:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-12  9:02 [U-Boot] [PATCH] usb: check udev before dereferencing Anatolij Gustschin
2016-11-12  9:36 ` Marek Vasut
2016-11-12 18:10   ` Anatolij Gustschin [this message]
2016-11-12 18:17     ` Marek Vasut
2016-11-14 20:44       ` Simon Glass

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=20161112191028.6acc5536@crub \
    --to=agust@denx.de \
    --cc=u-boot@lists.denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.