mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mattias Jacobsson <2pi@mok.nu>
To: Darren Hart <dvhart@infradead.org>
Cc: <andy@infradead.org>, <platform-driver-x86@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <2pi@mok.nu>
Subject: Re: [PATCH] platform/x86: wmi: fix potential null pointer dereferences
Date: Sun, 27 Jan 2019 12:46:37 +0100	[thread overview]
Message-ID: <20190127114636.quqb2mjmb6rozzko@mok.nu> (raw)
In-Reply-To: <20190126204355.GA13882@wrath>

Hi Darren,

On 2019-01-26, Darren Hart wrote:
> On Tue, Jan 22, 2019 at 09:03:01PM +0100, Mattias Jacobsson wrote:
> > In the function wmi_dev_match() there are three variables that
> > potentially can result in a null pointer dereference. Namely:
> 
> Is this something you have observed? This gets called when a new driver
> registered for each unassociated device on the bus, so I'm not
> immediately seeing how dev or driver would end up being NULL here.

I've observed that wmi_driver->id_table can be NULL, that can happen
when a WMI driver registers itself without specifying an id_table.

When adding a NULL check for wmi_driver->id_table, it felt wrong to not
do the same check for driver. After all, driver is a pointer given to me
from someone else, and can therefore be NULL. The same reasoning applies
to dev.

> 
> See: Documentation/driver-model/bus.txt
> 
> -- 
> Darren Hart
> VMware Open Source Technology Center

Thanks,
Mattias

  reply	other threads:[~2019-01-27 11:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-22 20:03 Mattias Jacobsson
2019-01-26 20:43 ` Darren Hart
2019-01-27 11:46   ` Mattias Jacobsson [this message]
2019-01-27 20:32 ` Andy Shevchenko
2019-01-28 14:38   ` Mattias Jacobsson
2019-01-28 15:49     ` Andy Shevchenko

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=20190127114636.quqb2mjmb6rozzko@mok.nu \
    --to=2pi@mok.nu \
    --cc=andy@infradead.org \
    --cc=dvhart@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=platform-driver-x86@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®