linux/fs/bcachefs
Christophe JAILLET 71933fb69b bcachefs: Fix use-after-free in bch2_dev_add()
If __bch2_dev_attach_bdev() fails, bch2_dev_free() is called twice.
Once here and another time in the error handling path.

This leads to several use-after-free.

Remove the redundant call and only rely on the error handling path.

Fixes: 6a44735653d4 ("bcachefs: Improved superblock-related error messages")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:10:13 -04:00
..
acl.c bcachefs: Heap allocate btree_trans 2023-10-22 17:10:13 -04:00
acl.h bcachefs: bch2_acl_to_text() 2023-10-22 17:10:12 -04:00
alloc_background.c bcachefs: Heap allocate btree_trans 2023-10-22 17:10:13 -04:00
alloc_background.h bcachefs: Kill bch2_bucket_gens_read() 2023-10-22 17:10:06 -04:00
alloc_foreground.c bcachefs: Heap allocate btree_trans 2023-10-22 17:10:13 -04:00
alloc_foreground.h bcachefs: sb-members.c 2023-10-22 17:10:10 -04:00
alloc_types.h bcachefs: Fix assorted checkpatch nits 2023-10-22 17:10:10 -04:00
backpointers.c bcachefs: Heap allocate btree_trans 2023-10-22 17:10:13 -04:00
backpointers.h bcachefs: remove duplicate code between backpointer update paths 2023-10-22 17:10:08 -04:00
bbpos.h bcachefs: Run bch2_check_backpointers_to_extents() in multiple passes if necessary 2023-10-22 17:09:51 -04:00
bcachefs_format.h bcachefs: Fix W=12 build errors 2023-10-22 17:10:13 -04:00
bcachefs_ioctl.h bcachefs: Convert to __packed and __aligned 2023-10-22 17:09:45 -04:00
bcachefs.h bcachefs: Heap allocate btree_trans 2023-10-22 17:10:13 -04:00
bkey_buf.h bcachefs: Move bkey bkey_unpack_key() to bkey.h 2023-10-22 17:09:45 -04:00
bkey_cmp.h bcachefs: bch2_bkey_cmp_packed_inlined() 2023-10-22 17:09:45 -04:00
bkey_methods.c bcachefs: Fix W=12 build errors 2023-10-22 17:10:13 -04:00
bkey_methods.h bcachefs: BCH_COMPAT_bformat_overflow_done no longer required 2023-10-22 17:10:09 -04:00
bkey_sort.c bcachefs: Use memcpy_u64s_small() for copying keys 2023-10-22 17:10:01 -04:00
bkey_sort.h bcachefs: Array bounds fixes 2023-10-22 17:10:12 -04:00
bkey.c bcachefs: Fix W=12 build errors 2023-10-22 17:10:13 -04:00
bkey.h bcachefs: Array bounds fixes 2023-10-22 17:10:12 -04:00
bset.c bcachefs: Fix W=12 build errors 2023-10-22 17:10:13 -04:00
bset.h bcachefs: bch2_btree_node_to_text() const correctness 2023-10-22 17:09:56 -04:00
btree_cache.c bcachefs: Fix W=12 build errors 2023-10-22 17:10:13 -04:00
btree_cache.h bcachefs: Assorted sparse fixes 2023-10-22 17:10:06 -04:00
btree_gc.c bcachefs: Heap allocate btree_trans 2023-10-22 17:10:13 -04:00
btree_gc.h bcachefs: Split up btree_update_leaf.c 2023-10-22 17:10:10 -04:00
btree_io.c bcachefs: Heap allocate btree_trans 2023-10-22 17:10:13 -04:00
btree_io.h bcachefs: Break up io.c 2023-10-22 17:10:12 -04:00
btree_iter.c bcachefs: Heap allocate btree_trans 2023-10-22 17:10:13 -04:00
btree_iter.h bcachefs: Heap allocate btree_trans 2023-10-22 17:10:13 -04:00
btree_journal_iter.c bcachefs: btree_journal_iter.c 2023-10-22 17:10:10 -04:00
btree_journal_iter.h bcachefs: btree_journal_iter.c 2023-10-22 17:10:10 -04:00
btree_key_cache.c bcachefs: Heap allocate btree_trans 2023-10-22 17:10:13 -04:00
btree_key_cache.h bcachefs: don't bump key cache journal seq on nojournal commits 2023-10-22 17:09:56 -04:00
btree_locking.c bcachefs: Assorted fixes for clang 2023-10-22 17:10:09 -04:00
btree_locking.h bcachefs: Fix silent enum conversion error 2023-10-22 17:10:12 -04:00
btree_trans_commit.c bcachefs: Heap allocate btree_trans 2023-10-22 17:10:13 -04:00
btree_types.h bcachefs: Heap allocate btree_trans 2023-10-22 17:10:13 -04:00
btree_update_interior.c bcachefs: Heap allocate btree_trans 2023-10-22 17:10:13 -04:00
btree_update_interior.h bcachefs: Move some declarations to the correct header 2023-10-22 17:10:08 -04:00
btree_update.c bcachefs: Heap allocate btree_trans 2023-10-22 17:10:13 -04:00
btree_update.h bcachefs: Heap allocate btree_trans 2023-10-22 17:10:13 -04:00
btree_write_buffer_types.h bcachefs: Btree write buffer 2023-10-22 17:09:50 -04:00
btree_write_buffer.c bcachefs: Heap allocate btree_trans 2023-10-22 17:10:13 -04:00
btree_write_buffer.h bcachefs: Btree write buffer 2023-10-22 17:09:50 -04:00
buckets_types.h bcachefs: Fragmentation LRU 2023-10-22 17:09:53 -04:00
buckets_waiting_for_journal_types.h bcachefs: New data structure for buckets waiting on journal commit 2023-10-22 17:09:22 -04:00
buckets_waiting_for_journal.c bcachefs: Fix -Wformat in bch2_set_bucket_needs_journal_commit() 2023-10-22 17:10:13 -04:00
buckets_waiting_for_journal.h bcachefs: New data structure for buckets waiting on journal commit 2023-10-22 17:09:22 -04:00
buckets.c bcachefs: Heap allocate btree_trans 2023-10-22 17:10:13 -04:00
buckets.h bcachefs: sb-members.c 2023-10-22 17:10:10 -04:00
chardev.c bcachefs: Convert -ENOENT to private error codes 2023-10-22 17:10:03 -04:00
chardev.h bcachefs: Fix assorted checkpatch nits 2023-10-22 17:10:10 -04:00
checksum.c bcachefs: Fix W=12 build errors 2023-10-22 17:10:13 -04:00
checksum.h bcachefs: Fix W=12 build errors 2023-10-22 17:10:13 -04:00
clock_types.h bcachefs: Persist 64 bit io clocks 2023-10-22 17:08:52 -04:00
clock.c bcachefs: Private error codes: ENOMEM 2023-10-22 17:09:57 -04:00
clock.h bcachefs: Convert various code to printbuf 2023-10-22 17:08:43 -04:00
compress.c bcachefs: Fix W=12 build errors 2023-10-22 17:10:13 -04:00
compress.h bcachefs: Compression levels 2023-10-22 17:10:07 -04:00
counters.c bcachefs: Remove unneeded semicolon 2023-10-22 17:10:13 -04:00
counters.h bcachefs: Add persistent counters 2023-10-22 17:09:32 -04:00
darray.h bcachefs: Assorted fixes for clang 2023-10-22 17:10:09 -04:00
data_update.c bcachefs: Heap allocate btree_trans 2023-10-22 17:10:13 -04:00
data_update.h bcachefs: Break up io.c 2023-10-22 17:10:12 -04:00
debug.c bcachefs: Heap allocate btree_trans 2023-10-22 17:10:13 -04:00
debug.h bcachefs: bch2_btree_node_ondisk_to_text() 2023-10-22 17:09:56 -04:00
dirent.c bcachefs: Heap allocate btree_trans 2023-10-22 17:10:13 -04:00
dirent.h bcachefs: Introduce bch2_dirent_get_name 2023-10-22 17:10:10 -04:00
disk_groups.c bcachefs: Fix W=12 build errors 2023-10-22 17:10:13 -04:00
disk_groups.h bcachefs: bch_opt_fn 2023-10-22 17:10:07 -04:00
ec_types.h bcachefs: Simplify ec stripes heap 2023-10-22 17:09:54 -04:00
ec.c bcachefs: Heap allocate btree_trans 2023-10-22 17:10:13 -04:00
ec.h bcachefs: Assorted fixes for clang 2023-10-22 17:10:09 -04:00
errcode.c bcachefs: Fix W=12 build errors 2023-10-22 17:10:13 -04:00
errcode.h bcachefs: trace_read_nopromote() 2023-10-22 17:10:12 -04:00
error.c bcachefs: Break up io.c 2023-10-22 17:10:12 -04:00
error.h bcachefs: fix_errors option is now a proper enum 2023-10-22 17:10:07 -04:00
extent_update.c bcachefs: Use for_each_btree_key_upto() more consistently 2023-10-22 17:09:50 -04:00
extent_update.h bcachefs: Reduce iter->trans usage 2023-10-22 17:09:10 -04:00
extents_types.h bcachefs: Limit pointers to being in only one stripe 2023-10-22 17:08:29 -04:00
extents.c bcachefs: Fix 'pointer to invalid device' check 2023-10-22 17:10:11 -04:00
extents.h bcachefs: Change check for invalid key types 2023-10-22 17:10:06 -04:00
eytzinger.h bcachefs: Make eytzinger size parameter more conventional 2023-10-22 17:09:21 -04:00
fifo.h bcachefs: More style fixes 2023-10-22 17:09:45 -04:00
fs-common.c bcachefs: Convert -ENOENT to private error codes 2023-10-22 17:10:03 -04:00
fs-common.h bcachefs: Add BCH_SUBVOLUME_UNLINKED 2023-10-22 17:09:15 -04:00
fs-io-buffered.c bcachefs: Heap allocate btree_trans 2023-10-22 17:10:13 -04:00
fs-io-buffered.h bcachefs: Split up fs-io.[ch] 2023-10-22 17:10:10 -04:00
fs-io-direct.c bcachefs: Heap allocate btree_trans 2023-10-22 17:10:13 -04:00
fs-io-direct.h bcachefs: Split up fs-io.[ch] 2023-10-22 17:10:10 -04:00
fs-io-pagecache.c bcachefs: Heap allocate btree_trans 2023-10-22 17:10:13 -04:00
fs-io-pagecache.h bcachefs: Split up fs-io.[ch] 2023-10-22 17:10:10 -04:00
fs-io.c bcachefs: Heap allocate btree_trans 2023-10-22 17:10:13 -04:00
fs-io.h bcachefs: New io_misc.c helpers 2023-10-22 17:10:12 -04:00
fs-ioctl.c bcachefs: Add btree_trans* to inode_set_fn 2023-10-22 17:10:10 -04:00
fs-ioctl.h bcachefs: Fix W=12 build errors 2023-10-22 17:10:13 -04:00
fs.c bcachefs: Heap allocate btree_trans 2023-10-22 17:10:13 -04:00
fs.h bcachefs: Add btree_trans* to inode_set_fn 2023-10-22 17:10:10 -04:00
fsck.c bcachefs: Heap allocate btree_trans 2023-10-22 17:10:13 -04:00
fsck.h bcachefs: Enumerate recovery passes 2023-10-22 17:10:06 -04:00
inode.c bcachefs: Heap allocate btree_trans 2023-10-22 17:10:13 -04:00
inode.h bcachefs: Kill missing inode warnings in bch2_quota_read() 2023-10-22 17:10:12 -04:00
io_misc.c bcachefs: Heap allocate btree_trans 2023-10-22 17:10:13 -04:00
io_misc.h bcachefs: Log finsert/fcollapse operations 2023-10-22 17:10:12 -04:00
io_read.c bcachefs: Heap allocate btree_trans 2023-10-22 17:10:13 -04:00
io_read.h bcachefs: Break up io.c 2023-10-22 17:10:12 -04:00
io_write_types.h bcachefs: Break up io.c 2023-10-22 17:10:12 -04:00
io_write.c bcachefs: Heap allocate btree_trans 2023-10-22 17:10:13 -04:00
io_write.h bcachefs: Break up io.c 2023-10-22 17:10:12 -04:00
journal_io.c bcachefs: Fix W=12 build errors 2023-10-22 17:10:13 -04:00
journal_io.h bcachefs: Convert journal validation to bkey_invalid_flags 2023-10-22 17:10:10 -04:00
journal_reclaim.c bcachefs: Fix W=12 build errors 2023-10-22 17:10:13 -04:00
journal_reclaim.h bcachefs: Make sure to initialize j->last_flushed 2023-10-22 17:09:02 -04:00
journal_sb.c bcachefs: Assorted sparse fixes 2023-10-22 17:10:06 -04:00
journal_sb.h bcachefs: Journal resize fixes 2023-10-22 17:09:56 -04:00
journal_seq_blacklist.c bcachefs: Heap allocate btree_trans 2023-10-22 17:10:13 -04:00
journal_seq_blacklist.h Revert "bcachefs: Delete some obsolete journal_seq_blacklist code" 2023-10-22 17:09:21 -04:00
journal_types.h bcachefs: Kill JOURNAL_WATERMARK 2023-10-22 17:10:05 -04:00
journal.c bcachefs: Heap allocate btree_trans 2023-10-22 17:10:13 -04:00
journal.h bcachefs: Kill JOURNAL_WATERMARK 2023-10-22 17:10:05 -04:00
Kconfig bcachefs: Compression levels 2023-10-22 17:10:07 -04:00
keylist_types.h
keylist.c bcachefs: GFP_NOIO -> GFP_NOFS 2023-10-22 17:10:03 -04:00
keylist.h bcachefs: Kill bch2_keylist_add_in_order() 2023-10-22 17:09:54 -04:00
logged_ops.c bcachefs: Heap allocate btree_trans 2023-10-22 17:10:13 -04:00
logged_ops.h bcachefs: Log finsert/fcollapse operations 2023-10-22 17:10:12 -04:00
lru.c bcachefs: Heap allocate btree_trans 2023-10-22 17:10:13 -04:00
lru.h bcachefs: bch2_btree_bit_mod() 2023-10-22 17:10:08 -04:00
Makefile bcachefs: BTREE_ID_logged_ops 2023-10-22 17:10:12 -04:00
mean_and_variance_test.c mean and variance: More tests 2023-10-22 17:10:02 -04:00
mean_and_variance.c bcachefs: Mean and variance 2023-10-22 17:09:43 -04:00
mean_and_variance.h mean and variance: Add a missing include 2023-10-22 17:10:02 -04:00
migrate.c bcachefs: Heap allocate btree_trans 2023-10-22 17:10:13 -04:00
migrate.h
move_types.h bcachefs: Rhashtable based buckets_in_flight for copygc 2023-10-22 17:09:58 -04:00
move.c bcachefs: Heap allocate btree_trans 2023-10-22 17:10:13 -04:00
move.h bcachefs: Break up io.c 2023-10-22 17:10:12 -04:00
movinggc.c bcachefs: Heap allocate btree_trans 2023-10-22 17:10:13 -04:00
movinggc.h bcachefs: bch2_copygc_wait_to_text() 2023-10-22 17:09:55 -04:00
nocow_locking_types.h bcachefs: Improved nocow locking 2023-10-22 17:09:52 -04:00
nocow_locking.c bcachefs: Add an assert to bch2_bucket_nocow_unlock() 2023-10-22 17:09:52 -04:00
nocow_locking.h bcachefs: Improved nocow locking 2023-10-22 17:09:52 -04:00
opts.c bcachefs: Handle weird opt string from sys_fsconfig() 2023-10-22 17:10:09 -04:00
opts.h bcachefs: Fix W=12 build errors 2023-10-22 17:10:13 -04:00
printbuf.c bcachefs: Fix W=12 build errors 2023-10-22 17:10:13 -04:00
printbuf.h bcachefs: Improve dev_alloc_debug_to_text() 2023-10-22 17:09:55 -04:00
quota_types.h bcachefs: bch2_fs_quota_transfer 2023-10-22 17:08:13 -04:00
quota.c bcachefs: Heap allocate btree_trans 2023-10-22 17:10:13 -04:00
quota.h bcachefs: Change check for invalid key types 2023-10-22 17:10:06 -04:00
rebalance_types.h bcachefs: add progress stats to sysfs 2023-10-22 17:09:10 -04:00
rebalance.c bcachefs: Break up io.c 2023-10-22 17:10:12 -04:00
rebalance.h bcachefs: Convert various code to printbuf 2023-10-22 17:08:43 -04:00
recovery_types.h bcachefs: BTREE_ID_logged_ops 2023-10-22 17:10:12 -04:00
recovery.c bcachefs: Heap allocate btree_trans 2023-10-22 17:10:13 -04:00
recovery.h bcachefs: btree_journal_iter.c 2023-10-22 17:10:10 -04:00
reflink.c bcachefs: Heap allocate btree_trans 2023-10-22 17:10:13 -04:00
reflink.h bcachefs: Change check for invalid key types 2023-10-22 17:10:06 -04:00
replicas_types.h bcachefs: Fix bch2_trans_reset_updates() 2023-10-22 17:09:50 -04:00
replicas.c bcachefs: Convert more code to bch_err_msg() 2023-10-22 17:10:12 -04:00
replicas.h bcachefs: Fix bch2_trans_reset_updates() 2023-10-22 17:09:50 -04:00
sb-clean.c bcachefs: sb-clean.c 2023-10-22 17:10:10 -04:00
sb-clean.h bcachefs: sb-clean.c 2023-10-22 17:10:10 -04:00
sb-members.c bcachefs: sb-members.c 2023-10-22 17:10:10 -04:00
sb-members.h bcachefs: sb-members.c 2023-10-22 17:10:10 -04:00
seqmutex.h bcachefs: seqmutex; fix a lockdep splat 2023-10-22 17:10:04 -04:00
siphash.c bcachefs: Assorted checkpatch fixes 2023-10-22 17:09:44 -04:00
siphash.h
six.c bcachefs: Fix W=12 build errors 2023-10-22 17:10:13 -04:00
six.h six locks: Split out seq, use atomic_t instead of atomic64_t 2023-10-22 17:10:02 -04:00
snapshot.c bcachefs: Heap allocate btree_trans 2023-10-22 17:10:13 -04:00
snapshot.h bcachefs: bch2_propagate_key_to_snapshot_leaves() 2023-10-22 17:10:11 -04:00
str_hash.h bcachefs: Convert -ENOENT to private error codes 2023-10-22 17:10:03 -04:00
subvolume_types.h bcachefs: is_ancestor bitmap 2023-10-22 17:10:07 -04:00
subvolume.c bcachefs: Heap allocate btree_trans 2023-10-22 17:10:13 -04:00
subvolume.h bcachefs: Fix -Wincompatible-function-pointer-types-strict from key_invalid callbacks 2023-10-22 17:10:13 -04:00
super_types.h bcachefs: Fix bch_sb_handle type 2023-10-22 17:10:12 -04:00
super-io.c bcachefs: Fix W=12 build errors 2023-10-22 17:10:13 -04:00
super-io.h bcachefs: sb-clean.c 2023-10-22 17:10:10 -04:00
super.c bcachefs: Fix use-after-free in bch2_dev_add() 2023-10-22 17:10:13 -04:00
super.h bcachefs: sb-members.c 2023-10-22 17:10:10 -04:00
sysfs.c bcachefs: Heap allocate btree_trans 2023-10-22 17:10:13 -04:00
sysfs.h bcachefs: Add persistent counters 2023-10-22 17:09:32 -04:00
tests.c bcachefs: Heap allocate btree_trans 2023-10-22 17:10:13 -04:00
tests.h bcachefs: Add error handling to unit & perf tests 2023-10-22 17:08:48 -04:00
trace.c bcachefs: Improve trans_restart_split_race tracepoint 2023-10-22 17:09:58 -04:00
trace.h bcachefs: trace_read_nopromote() 2023-10-22 17:10:12 -04:00
two_state_shared_lock.c bcachefs: Inline bch2_two_state_(trylock|unlock) 2023-10-22 17:09:51 -04:00
two_state_shared_lock.h bcachefs: Inline bch2_two_state_(trylock|unlock) 2023-10-22 17:09:51 -04:00
util.c bcachefs: Fix W=12 build errors 2023-10-22 17:10:13 -04:00
util.h bcachefs: Fix W=12 build errors 2023-10-22 17:10:13 -04:00
varint.c bcachefs: Fix W=12 build errors 2023-10-22 17:10:13 -04:00
varint.h bcachefs: Add safe versions of varint encode/decode 2023-10-22 17:09:08 -04:00
vstructs.h bcachefs: Array bounds fixes 2023-10-22 17:10:12 -04:00
xattr.c bcachefs: Heap allocate btree_trans 2023-10-22 17:10:13 -04:00
xattr.h bcachefs: bch2_xattr_set() now updates ctime 2023-10-22 17:10:06 -04:00