FAILED: patch "[PATCH] driver core: Fix probe_count imbalance in really_probe()" failed to apply to 5.4-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 5.4-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From b292b50b0efcc7095d8bf15505fba6909bb35dce Mon Sep 17 00:00:00 2001
From: Tetsuo Handa <[email protected]>
Date: Mon, 13 Jul 2020 11:12:54 +0900
Subject: [PATCH] driver core: Fix probe_count imbalance in really_probe()
syzbot is reporting hung task in wait_for_device_probe() [1]. At least, we always need to decrement probe_count if we incremented probe_count in really_probe().
However, since I can't find "Resources present before probing" message in the console log, both "this message simply flowed off" and "syzbot is not hitting this path" will be possible. Therefore, while we are at it, let's also prepare for concurrent wait_for_device_probe() calls by replacing wake_up() with wake_up_all().
[1] https://syzkaller.appspot.com/bug?id=25c833f1983c9c1d512f4ff860dd0d7f5a2e2c0f
drivers/base/dd.c +4 -3
@@ -276,7 +276,7 @@ static void deferred_probe_timeout_work_func(struct work_struct *work)list_for_each_entry_safe (private, p, &deferred_probe_pending_list, deferred_probe)dev_info (private->device,"deferred probe pending\n" ); -wake_up (&probe_timeout_waitqueue); +wake_up_all (&probe_timeout_waitqueue); } static DECLARE_DELAYED_WORK(deferred_probe_timeout_work, deferred_probe_timeout_work_func);
@@ -498,7 +498,8 @@ static int really_probe(struct device *dev, struct device_driver *drv) drv->bus->name, __func__, drv->name, dev_name(dev));if (!list_empty (&dev->devres_head)) {dev_crit (dev,"Resources present before probing\n" ); -return -EBUSY ; + ret = -EBUSY ; + goto done; } re_probe:
@@ -627,7 +628,7 @@ static int really_probe(struct device *dev, struct device_driver *drv) ret =0 ; done:atomic_dec (&probe_count); -wake_up (&probe_waitqueue); +wake_up_all (&probe_waitqueue);return ret; }