diff options
| author | Adarsh Das <adarshdas950@gmail.com> | 2026-10-07 21:33:49 +0530 |
|---|---|---|
| committer | David Sterba <dsterba@suse.com> | 2026-10-30 23:13:59 +0100 |
| commit | 20c14ad8a9a0f70c2af8e44c6b80a6c942eb7fdd (patch) | |
| tree | d773ef04253af2aecba04a4425116848c59e1e6a /scripts/Makefile.thinlto | |
| parent | 16b8f07d1ed50d4a8da468b56484873784dd8f4a (diff) | |
| download | linux-next-20c14ad8a9a0f70c2af8e44c6b80a6c942eb7fdd.tar.gz linux-next-20c14ad8a9a0f70c2af8e44c6b80a6c942eb7fdd.zip | |
btrfs: unwind device add when sysfs registration fails
btrfs_init_new_device() ignored the return value of
btrfs_sysfs_add_device(). When sysfs link creation failed (e.g. -EEXIST),
the add path continued, aborted the transaction with the same errno, and
tripped WARN_ON(btrfs_abort_should_print_stack()) while leaving the device
half-registered in memory.
Check the return value and unwind when registration fails, without
aborting the filesystem for errnos like -EEXIST. If add failed before
anything was published in sysfs, tear down the in-memory device state only
and do not call btrfs_sysfs_remove_device(). When the block-device link
was created but devid kobject registration fails, drop the link inside
btrfs_sysfs_add_device() before returning the error.
Reported-by: syzbot+3bf3e110b2d406b8166c@syzkaller.appspotmail.com
Link: https://lore.kernel.org/all/6a791c94.01d0871a.3a0d52.0099.GAE@google.com
Tested-by: syzbot+3bf3e110b2d406b8166c@syzkaller.appspotmail.com
Assisted-by: LLM
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Adarsh Das <adarshdas950@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'scripts/Makefile.thinlto')
0 files changed, 0 insertions, 0 deletions
