[lkml]   [2018]   [Sep]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH 4.18 086/235] drivers/base: stop new probing during shutdown
4.18-stable review patch.  If anyone has any objections, please let me know.


From: Pingfan Liu <>

[ Upstream commit 3297c8fc65af5d40501ea7cddff1b195cae57e4e ]

There is a race window in device_shutdown(), which may cause
-1. parent device shut down before child or
-2. no shutdown on a new probing device.

For 1st, taking the following scenario:
device_shutdown new plugin device
probe child
shutdown parent_dev
--> now child is on the tail of devices_kset

For 2nd, taking the following scenario:
device_shutdown new plugin device
probe dev
--> now, the new occurred dev has no opportunity to shutdown

To fix this race issue, just prevent the new probing request. With this
logic, device_shutdown() is more similar to dpm_prepare().

Signed-off-by: Pingfan Liu <>
Reviewed-by: Rafael J. Wysocki <>
Signed-off-by: Greg Kroah-Hartman <>
Signed-off-by: Sasha Levin <>
Signed-off-by: Greg Kroah-Hartman <>
drivers/base/core.c | 3 +++
1 file changed, 3 insertions(+)

--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -2809,6 +2809,9 @@ void device_shutdown(void)
struct device *dev, *parent;

+ wait_for_device_probe();
+ device_block_probing();
* Walk the devices list backward, shutting down each in turn.

 \ /
  Last update: 2018-09-24 14:51    [W:0.884 / U:0.852 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site