Skip to content

Commit 4f2c346

Browse files
Stuart Hayesgregkh
authored andcommitted
driver core: fix async device shutdown hang
Modify device_shutdown() so that supplier devices do not wait for consumer devices to be shut down first when the devlink is sync state only, since the consumer is not dependent on the supplier in this case. Without this change, a circular dependency could hang the system. Fixes: 8064952 ("driver core: shut down devices asynchronously") Signed-off-by: Stuart Hayes <[email protected]> Tested-by: Laurence Oberman <[email protected]> Tested-by: Nathan Chancellor <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 6a36d82 commit 4f2c346

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

drivers/base/core.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4898,8 +4898,16 @@ void device_shutdown(void)
48984898

48994899
idx = device_links_read_lock();
49004900
list_for_each_entry_rcu(link, &dev->links.suppliers, c_node,
4901-
device_links_read_lock_held())
4901+
device_links_read_lock_held()) {
4902+
/*
4903+
* sync_state_only suppliers don't need to wait,
4904+
* aren't reordered on devices_kset, so making them
4905+
* wait could result in a hang
4906+
*/
4907+
if (device_link_flag_is_sync_state_only(link->flags))
4908+
continue;
49024909
link->supplier->p->shutdown_after = cookie;
4910+
}
49034911
device_links_read_unlock(idx);
49044912
put_device(dev);
49054913

0 commit comments

Comments
 (0)