Re: [syzbot] [kernel?] linux-next test error: WARNING in class_for_each_device

From: Tetsuo Handa

Date: Tue May 26 2026 - 08:08:29 EST


On 2026/05/26 16:19, Tetsuo Handa wrote:
> On 2026/05/26 15:08, Tetsuo Handa wrote:
>> On 2026/05/26 14:55, syzbot wrote:
>>> Hello,
>>>
>>> syzbot found the following issue on:
>>>
>>> HEAD commit: d387b06f7c15 Add linux-next specific files for 20260525
>>> git tree: linux-next
>>> console output: https://syzkaller.appspot.com/x/log.txt?x=15eb7796580000
>>> kernel config: https://syzkaller.appspot.com/x/.config?x=8dd72cf810e753a6
>>> dashboard link: https://syzkaller.appspot.com/bug?extid=50b5f81fff158669504a
>>> compiler: Debian clang version 21.1.8 (++20251221033036+2078da43e25a-1~exp1~20251221153213.50), Debian LLD 21.1.8
>>>
>>> Downloadable assets:
>>> disk image: https://storage.googleapis.com/syzbot-assets/39490dfbc250/disk-d387b06f.raw.xz
>>> vmlinux: https://storage.googleapis.com/syzbot-assets/0789ac7ac5fc/vmlinux-d387b06f.xz
>>> kernel image: https://storage.googleapis.com/syzbot-assets/4464df9f5ccf/bzImage-d387b06f.xz
>>>
>>> IMPORTANT: if you fix the issue, please add the following tag to the commit:
>>> Reported-by: syzbot+50b5f81fff158669504a@xxxxxxxxxxxxxxxxxxxxxxxxx
>>>
>>> ------------[ cut here ]------------
>>> class_for_each_device called for class 'devlink' before it was registered
>> https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/drivers/base?id=1137838865bfc9a7cd5869c1dc5c22aa45ec12c8
>>
>> Why "driver_deferred_probe_timeout * HZ" => "driver_deferred_probe_timeout" ?
>>
>
> Here is an analysis from Google AI mode regarding this problem: https://share.google/aimode/UO1WnoKPDSbyjY5Qj
>
> Greg, can you immediately drop commit 1137838865bf ("driver core: Use mod_delayed_work to prevent
> lost deferred probe work") so that syzbot can resume testing linux-next tree as soon as possible?
>

Below diff was generated via conversation with AI Mode in Google Search, and
I agree that this diff should fix the problem. I'm waiting for Greg's response
on how to proceed. Mark, can you carry below diff as a hotfix for linux-next tree?

---
drivers/base/dd.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index 172a02a438a2..265717a19b08 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -298,10 +298,14 @@ int driver_deferred_probe_check_state(struct device *dev)
}
EXPORT_SYMBOL_GPL(driver_deferred_probe_check_state);

+static int deferred_probe_timeout_triggered __data_racy;
static void deferred_probe_timeout_work_func(struct work_struct *work)
{
struct device_private *p;

+ if (cmpxchg(&deferred_probe_timeout_triggered, 0, 1))
+ return;
+
fw_devlink_drivers_done();

driver_deferred_probe_timeout = 0;
@@ -323,8 +327,9 @@ void deferred_probe_extend_timeout(void)
* If the work hasn't been queued yet or if the work expired, don't
* start a new one.
*/
- if (mod_delayed_work(system_wq, &deferred_probe_timeout_work,
- driver_deferred_probe_timeout))
+ if (!deferred_probe_timeout_triggered &&
+ mod_delayed_work(system_wq, &deferred_probe_timeout_work,
+ driver_deferred_probe_timeout * HZ))
pr_debug("Extended deferred probe timeout by %d secs\n",
driver_deferred_probe_timeout);
}
@@ -357,10 +362,11 @@ static int deferred_probe_initcall(void)
driver_deferred_probe_trigger();
flush_work(&deferred_probe_work);

- if (driver_deferred_probe_timeout > 0) {
+ if (driver_deferred_probe_timeout > 0)
schedule_delayed_work(&deferred_probe_timeout_work,
driver_deferred_probe_timeout * HZ);
- }
+ else
+ deferred_probe_timeout_triggered = 1;

if (!IS_ENABLED(CONFIG_MODULES))
fw_devlink_probing_done();
--
2.54.0