kernel_samsung_a53x/fs/btrfs
Filipe Manana 506bbb9474 btrfs: reinitialize delayed ref list after deleting it from the list
commit c9a75ec45f1111ef530ab186c2a7684d0a0c9245 upstream.

At insert_delayed_ref() if we need to update the action of an existing
ref to BTRFS_DROP_DELAYED_REF, we delete the ref from its ref head's
ref_add_list using list_del(), which leaves the ref's add_list member
not reinitialized, as list_del() sets the next and prev members of the
list to LIST_POISON1 and LIST_POISON2, respectively.

If later we end up calling drop_delayed_ref() against the ref, which can
happen during merging or when destroying delayed refs due to a transaction
abort, we can trigger a crash since at drop_delayed_ref() we call
list_empty() against the ref's add_list, which returns false since
the list was not reinitialized after the list_del() and as a consequence
we call list_del() again at drop_delayed_ref(). This results in an
invalid list access since the next and prev members are set to poison
pointers, resulting in a splat if CONFIG_LIST_HARDENED and
CONFIG_DEBUG_LIST are set or invalid poison pointer dereferences
otherwise.

So fix this by deleting from the list with list_del_init() instead.

Fixes: 1d57ee941692 ("btrfs: improve delayed refs iterations")
CC: stable@vger.kernel.org # 4.19+
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-11-30 02:33:25 +01:00
..
tests Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
acl.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
async-thread.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
async-thread.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
backref.c btrfs: fix information leak in btrfs_ioctl_logical_to_ino() 2024-11-19 11:32:38 +01:00
backref.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
block-group.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
block-group.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
block-rsv.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
block-rsv.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
btrfs_inode.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
check-integrity.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
check-integrity.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
compression.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
compression.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ctree.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ctree.h btrfs: unify lookup return value when dir entry is missing 2024-11-18 22:25:36 +01:00
delalloc-space.c btrfs: don't arbitrarily slow down delalloc if we're committing 2024-11-18 11:43:24 +01:00
delalloc-space.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
delayed-inode.c btrfs: change BUG_ON to assertion when checking for delayed_node root 2024-11-23 23:20:46 +01:00
delayed-inode.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
delayed-ref.c btrfs: reinitialize delayed ref list after deleting it from the list 2024-11-30 02:33:25 +01:00
delayed-ref.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dev-replace.c btrfs: dev-replace: properly validate device names 2024-11-18 23:18:29 +01:00
dev-replace.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dir-item.c btrfs: unify lookup return value when dir entry is missing 2024-11-18 22:25:36 +01:00
discard.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
discard.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
disk-io.c Revert "btrfs: wait for fixup workers before stopping cleaner kthread during umount" 2024-11-24 00:23:01 +01:00
disk-io.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
export.c btrfs: export: handle invalid inode or root reference in btrfs_get_parent() 2024-11-19 09:23:13 +01:00
export.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
extent-io-tree.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
extent-tree.c Revert "btrfs: replace BUG_ON with ASSERT in walk_down_proc()" 2024-11-24 00:23:39 +01:00
extent_io.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
extent_io.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
extent_map.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
extent_map.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
file-item.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
file.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
free-space-cache.c btrfs: rename bitmap_set_bits() -> btrfs_bitmap_set_bits() 2024-11-23 23:20:43 +01:00
free-space-cache.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
free-space-tree.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
free-space-tree.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
inode-item.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
inode-map.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
inode-map.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
inode.c Revert "btrfs: initialize location to fix -Wmaybe-uninitialized in btrfs_lookup_dentry()" 2024-11-24 00:23:39 +01:00
ioctl.c btrfs: fix use-after-free after failure to create a snapshot 2024-11-23 23:21:01 +01:00
Kconfig Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
locking.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
locking.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
lzo.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Makefile Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
misc.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ordered-data.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ordered-data.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
orphan.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
print-tree.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
print-tree.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
props.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
props.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
qgroup.c btrfs: delete pointless BUG_ON check on quota root in btrfs_qgroup_account_extent() 2024-11-23 23:20:46 +01:00
qgroup.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
raid56.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
raid56.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
rcu-string.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
reada.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ref-verify.c btrfs: ref-verify: free ref cache before clearing mount opt 2024-11-18 12:13:01 +01:00
ref-verify.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
reflink.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
reflink.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
relocation.c Revert "btrfs: fix a NULL pointer dereference when failed to start a new trasacntion" 2024-11-24 00:23:01 +01:00
root-tree.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
scrub.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
send.c btrfs: send: handle unexpected data in header buffer in begin_cmd() 2024-11-23 23:20:46 +01:00
send.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
space-info.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
space-info.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
struct-funcs.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
super.c Revert "btrfs: add dmesg output for first mount and last unmount of a filesystem" 2024-11-18 12:11:47 +01:00
sysfs.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
sysfs.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
transaction.c btrfs: fix use-after-free after failure to create a snapshot 2024-11-23 23:21:01 +01:00
transaction.h btrfs: fix use-after-free after failure to create a snapshot 2024-11-23 23:21:01 +01:00
tree-checker.c btrfs: tree-checker: add dev extent item checks 2024-11-23 23:20:43 +01:00
tree-checker.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tree-defrag.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tree-log.c btrfs: unify lookup return value when dir entry is missing 2024-11-18 22:25:36 +01:00
tree-log.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ulist.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ulist.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
uuid-tree.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
volumes.c btrfs: add missing mutex_unlock in btrfs_relocate_sys_chunks() 2024-11-19 12:26:50 +01:00
volumes.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xattr.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xattr.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
zlib.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
zstd.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00