Re: Test patch for devlink warning
From: syzbot
Date: Sun May 31 2026 - 07:07:06 EST
> #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
This crash does not have a reproducer. I cannot test it.
> e7e28506af98
>
> From e997d178d3a8d58d3d5fe9e837f2814bd2252e58 Mon Sep 17 00:00:00 2001
> From: Bharath Reddy <kbreddy.rpbc@xxxxxxxxx>
> Date: Sun, 31 May 2026 16:16:30 +0530
> Subject: [PATCH] driver core: Fix unregistered class iterations in fw_devlink
>
> Add a check to verify devlink_class is registered before iterating over
> its devices in both fw_devlink_drivers_done() and fw_devlink_probing_done().
>
> This prevents a warning caused by deferred probing timeouts firing before
> the class is fully initialized, and proactively protects the late initcall
> probing path against class registration failures.
>
> Reported-by: syzbot+c750936fbcad82cf6da9@xxxxxxxxxxxxxxxxxxxxxxxxx
>
> Signed-off-by: Bharath Reddy <kbreddy.rpbc@xxxxxxxxx>
> ---
> drivers/base/core.c | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/base/core.c b/drivers/base/core.c
> index 4d026682944f..7c7dfecc7a2b 100644
> --- a/drivers/base/core.c
> +++ b/drivers/base/core.c
> @@ -1834,8 +1834,10 @@ void fw_devlink_drivers_done(void)
> {
> fw_devlink_drv_reg_done = true;
> device_links_write_lock();
> - class_for_each_device(&devlink_class, NULL, NULL,
> - fw_devlink_no_driver);
> + if (class_is_registered(&devlink_class)) {
> + class_for_each_device(&devlink_class, NULL, NULL,
> + fw_devlink_no_driver);
> + }
> device_links_write_unlock();
> }
>
> @@ -1871,8 +1873,10 @@ void fw_devlink_probing_done(void)
> LIST_HEAD(sync_list);
>
> device_links_write_lock();
> - class_for_each_device(&devlink_class, NULL, &sync_list,
> - fw_devlink_dev_sync_state);
> + if (class_is_registered(&devlink_class)) {
> + class_for_each_device(&devlink_class, NULL, &sync_list,
> + fw_devlink_dev_sync_state);
> + }
> device_links_write_unlock();
> device_links_flush_sync_list(&sync_list, NULL);
> }
> --
> 2.34.1