Forwarded: Re: [syzbot] WARNING in btrfs_init_new_device
From: syzbot
Date: Sat Oct 03 2026 - 05:19:37 EST
For archival purposes, forwarding an incoming command email to
linux-kernel@xxxxxxxxxxxxxxx, syzkaller-bugs@xxxxxxxxxxxxxxxx.
***
Subject: Re: [syzbot] WARNING in btrfs_init_new_device
Author: adarshdas950@xxxxxxxxx
#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 85ea9c5d4536..1517ed3da22c 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -3066,7 +3066,11 @@ int btrfs_init_new_device(struct btrfs_fs_info *fs_info, const char *device_path
mutex_unlock(&fs_info->chunk_mutex);
/* Add sysfs device entry */
- btrfs_sysfs_add_device(device);
+ ret = btrfs_sysfs_add_device(device);
+ if (ret) {
+ mutex_unlock(&fs_devices->device_list_mutex);
+ goto error_sysfs;
+ }
mutex_unlock(&fs_devices->device_list_mutex);