From d548623dd59ab270af694012a6be61b805585325 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 9 Oct 2020 11:40:24 +0200 Subject: [PATCH] 4.19-stable patches added patches: driver-core-fix-probe_count-imbalance-in-really_probe.patch --- ...robe_count-imbalance-in-really_probe.patch | 55 +++++++++++++++++++ queue-4.19/series | 1 + 2 files changed, 56 insertions(+) create mode 100644 queue-4.19/driver-core-fix-probe_count-imbalance-in-really_probe.patch diff --git a/queue-4.19/driver-core-fix-probe_count-imbalance-in-really_probe.patch b/queue-4.19/driver-core-fix-probe_count-imbalance-in-really_probe.patch new file mode 100644 index 00000000000..b9995861f3f --- /dev/null +++ b/queue-4.19/driver-core-fix-probe_count-imbalance-in-really_probe.patch @@ -0,0 +1,55 @@ +From b292b50b0efcc7095d8bf15505fba6909bb35dce Mon Sep 17 00:00:00 2001 +From: Tetsuo Handa +Date: Mon, 13 Jul 2020 11:12:54 +0900 +Subject: driver core: Fix probe_count imbalance in really_probe() + +From: Tetsuo Handa + +commit b292b50b0efcc7095d8bf15505fba6909bb35dce upstream. + +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 + +Reported-by: syzbot +Fixes: 7c35e699c88bd607 ("driver core: Print device when resources present in really_probe()") +Cc: Geert Uytterhoeven +Signed-off-by: Tetsuo Handa +Cc: stable +Link: https://lore.kernel.org/r/20200713021254.3444-1-penguin-kernel@I-love.SAKURA.ne.jp +[iwamatsu: Drop patch for deferred_probe_timeout_work_func()] +Signed-off-by: Nobuhiro Iwamatsu (CIP) +Signed-off-by: Greg Kroah-Hartman +--- + drivers/base/dd.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +--- a/drivers/base/dd.c ++++ b/drivers/base/dd.c +@@ -472,7 +472,8 @@ static int really_probe(struct device *d + 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: +@@ -579,7 +580,7 @@ pinctrl_bind_failed: + ret = 0; + done: + atomic_dec(&probe_count); +- wake_up(&probe_waitqueue); ++ wake_up_all(&probe_waitqueue); + return ret; + } + diff --git a/queue-4.19/series b/queue-4.19/series index d57e161e3ac..ae605f42266 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -9,3 +9,4 @@ platform-x86-intel-vbtn-fix-sw_tablet_mode-always-reporting-1-on-the-hp-pavilion platform-x86-thinkpad_acpi-initialize-tp_nvram_state-variable.patch platform-x86-intel-vbtn-switch-to-an-allow-list-for-sw_tablet_mode-reporting.patch platform-x86-thinkpad_acpi-re-initialize-acpi-buffer-size-when-reuse.patch +driver-core-fix-probe_count-imbalance-in-really_probe.patch -- 2.47.3