]> git.baikalelectronics.ru Git - kernel.git/commit
software node: Handle software node injection to an existing device properly
authorHeikki Krogerus <heikki.krogerus@linux.intel.com>
Wed, 23 Jun 2021 13:14:21 +0000 (16:14 +0300)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 23 Jun 2021 17:34:58 +0000 (19:34 +0200)
commit3911bff9c800a734d69c208f3e39809cfb43d709
treee6638b0f32b8b2ab911010141e923ab7349ef43c
parent2a7e5e96f3d2bd3974a6a4d3721da1f29f4b1349
software node: Handle software node injection to an existing device properly

The function software_node_notify() - the function that creates
and removes the symlinks between the node and the device - was
called unconditionally in device_add_software_node() and
device_remove_software_node(), but it needs to be called in
those functions only in the special case where the node is
added to a device that has already been registered.

This fixes NULL pointer dereference that happens if
device_remove_software_node() is used with device that was
never registered.

Fixes: e3f46be1cca2 ("software node: Allow node addition to already existing device")
Reported-and-tested-by: Dominik Brodowski <linux@dominikbrodowski.net>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/base/swnode.c