]> asedeno.scripts.mit.edu Git - linux.git/commit
driver core: Fix DL_FLAG_AUTOREMOVE_SUPPLIER device link flag handling
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 1 Feb 2019 00:45:55 +0000 (01:45 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 1 Feb 2019 09:04:08 +0000 (10:04 +0100)
commitc8d50986da5d74ddfc233b13b91d0a13369fa164
tree6991722cda34405ab1a19425a5ce1c6dd6eb9f87
parent8d84b18f5678d3adfdb9375dfb0d968da2dc753d
driver core: Fix DL_FLAG_AUTOREMOVE_SUPPLIER device link flag handling

Change the list walk in device_links_driver_cleanup() to a safe one
to avoid use-after-free when dropping a link from the list during the
walk.

Also, while at it, fix device_link_add() to refuse to create
stateless device links with DL_FLAG_AUTOREMOVE_SUPPLIER set, which is
an invalid combination (setting that flag means that the driver core
should manage the link, so it cannot be stateless), and extend the
kerneldoc comment of device_link_add() to cover the
DL_FLAG_AUTOREMOVE_SUPPLIER flag properly too.

Fixes: 1689cac5b32a ("driver core: Add flag to autoremove device link on supplier unbind")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/base/core.c