diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2015-08-05 16:51:11 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-10-22 14:49:28 -0700 |
commit | 4fe5efbe4de66c283385dbb08e2adf6b6d60647a (patch) | |
tree | cf6461ffa0d375fc6b2417fd01733bb7b9209f8d /drivers | |
parent | 8348de5dc44bd911cc7b2e731cc5ec04085cda65 (diff) | |
download | lwn-4fe5efbe4de66c283385dbb08e2adf6b6d60647a.tar.gz lwn-4fe5efbe4de66c283385dbb08e2adf6b6d60647a.zip |
device property: fix potential NULL pointer dereference
commit ecc87eed7beeb50c0be0b73322d62135277ea2b0 upstream.
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>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/base/property.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/base/property.c b/drivers/base/property.c index f3f6d167f3f1..37a7bb7b239d 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); |