Re: [syzbot] [kernfs?] [usb?] WARNING in kernfs_get (5)

From: Hillf Danton
Date: Thu May 16 2024 - 10:28:21 EST


On Tue, 14 May 2024 08:44:43 -0700
> syzbot has found a reproducer for the following issue on:
>
> HEAD commit: 26dd54d03cd9 Add linux-next specific files for 20240514
> git tree: linux-next
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=14b06900980000

#syz test https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git 26dd54d03cd9

--- l/drivers/base/firmware_loader/fallback.c
+++ f/drivers/base/firmware_loader/fallback.c
@@ -64,6 +64,7 @@ void kill_pending_fw_fallback_reqs(bool
mutex_unlock(&fw_lock);
}

+static DEFINE_MUTEX(fw_load_sysfs_mutex);
/**
* fw_load_sysfs_fallback() - load a firmware via the sysfs fallback mechanism
* @fw_sysfs: firmware sysfs information for the firmware to load
@@ -82,6 +83,7 @@ static int fw_load_sysfs_fallback(struct
fw_priv->is_paged_buf = true;

dev_set_uevent_suppress(f_dev, true);
+ mutex_lock(&fw_load_sysfs_mutex);

retval = device_add(f_dev);
if (retval) {
@@ -124,6 +126,7 @@ out:
device_del(f_dev);
err_put_dev:
put_device(f_dev);
+ mutex_unlock(&fw_load_sysfs_mutex);
return retval;
}

--