device property: fix for a case of use-after-free
authorHeikki Krogerus <heikki.krogerus@linux.intel.com>
Thu, 10 Mar 2016 11:03:18 +0000 (13:03 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 10 Mar 2016 20:33:16 +0000 (21:33 +0100)
commit0d67e0fa1664ad6aaba0552e170608bafb4b6196
tree28987f5570ca421359271c4bc22b3dca3f90dd66
parent7781203416ffc4e731619f8a8b93a37599a8f502
device property: fix for a case of use-after-free

In device_remove_property_set(), the secondary fwnode needs
to be cleared before the pset is freed. This fixes a
use-after-free when a property set is providing the primary
fwnode.

As a result of the fix, the primary fwnode may end up
containing ERR_PTR(-ENODEV), so also adding checks for it to
the property handling code.

Reported-by: John Youn <John.Youn@synopsys.com>
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/base/property.c