mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: "Rafael J . Wysocki" <rafael.j.wysocki@intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] device property: fix potential NULL pointer dereference
Date: Thu, 06 Aug 2015 01:20:56 +0200	[thread overview]
Message-ID: <1461784.GDeppdBeAX@vostro.rjw.lan> (raw)
In-Reply-To: <1438782671-10337-1-git-send-email-andriy.shevchenko@linux.intel.com>

On Wednesday, August 05, 2015 04:51:11 PM Andy Shevchenko wrote:
> In device_add_property_set() we check pset parameter for a NULL, but few lines
> later we do a pointer arithmetic without check that will crash kernel in the
> set_secondary_fwnode().
> 
> Here we check if pset parameter is NULL and return immediately.
> 
> Fixes: 16ba08d5c9ec (device property: Introduce firmware node type for platform data)
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

I don't think there are any users of this in 4.2, so I'll queue it up for 4.3.

Thanks!


> ---
>  drivers/base/property.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/base/property.c b/drivers/base/property.c
> index f3f6d16..37a7bb7 100644
> --- a/drivers/base/property.c
> +++ b/drivers/base/property.c
> @@ -27,9 +27,10 @@
>   */
>  void device_add_property_set(struct device *dev, struct property_set *pset)
>  {
> -	if (pset)
> -		pset->fwnode.type = FWNODE_PDATA;
> +	if (!pset)
> +		return;
>  
> +	pset->fwnode.type = FWNODE_PDATA;
>  	set_secondary_fwnode(dev, &pset->fwnode);
>  }
>  EXPORT_SYMBOL_GPL(device_add_property_set);
> 

-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

      reply	other threads:[~2015-08-05 22:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-05 13:51 Andy Shevchenko
2015-08-05 23:20 ` Rafael J. Wysocki [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=1461784.GDeppdBeAX@vostro.rjw.lan \
    --to=rjw@rjwysocki.net \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael.j.wysocki@intel.com \
    /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®