kernel_samsung_a53x/fs
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
..
9p fs/9p: drop inodes immediately on non-.L too 2024-11-19 11:32:45 +01:00
adfs Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
affs Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
afs afs: Don't cross .backup mountpoint from backup volume 2024-11-19 12:27:12 +01:00
autofs Revert "file: Replace ksys_close with close_fd" 2024-11-19 12:59:08 +01:00
befs Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
bfs Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
btrfs btrfs: reinitialize delayed ref list after deleting it from the list 2024-11-30 02:33:25 +01:00
cachefiles Revert "namei: introduce struct renamedata" 2024-11-19 13:45:08 +01:00
ceph Revert "ceph: remove the incorrect Fw reference check when dirtying pages" 2024-11-24 00:23:13 +01:00
cifs smb: client: fix OOBs when building SMB2_IOCTL request 2024-11-23 23:21:59 +01:00
coda Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
configfs Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cramfs Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
crypto Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
debugfs debugfs: fix automount d_fsdata usage 2024-11-18 12:12:12 +01:00
devpts Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dlm Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ecryptfs Revert "namei: introduce struct renamedata" 2024-11-19 13:45:08 +01:00
efivarfs efivarfs: force RO when remounting if SetVariable is not supported 2024-11-18 12:12:25 +01:00
efs Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
erofs BACKPORT: erofs: fix lz4 inplace decompression 2024-11-17 17:41:30 +01:00
exfat Revert "exfat: fix memory leak in exfat_load_bitmap()" 2024-11-24 00:23:02 +01:00
exportfs exportfs: use pr_debug for unreachable debug statements 2024-11-19 12:28:26 +01:00
ext2 ext2: Verify bitmap and itable block numbers before using them 2024-11-23 23:20:12 +01:00
ext4 Revert "ext4: handle redirtying in ext4_bio_write_page()" 2024-11-24 00:23:46 +01:00
f2fs Revert "f2fs: fix to update i_ctime in __f2fs_setxattr()" 2024-11-24 00:23:20 +01:00
fat Revert "fat: fix uninitialized variable" 2024-11-24 00:22:53 +01:00
freevxfs Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fscache Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fuse Revert "virtiofs: forbid newlines in tags" 2024-11-24 00:23:52 +01:00
gfs2 gfs2: setattr_chown: Add missing initialization 2024-11-23 23:20:45 +01:00
hfs hfs: fix to initialize fields of hfs_inode_info after hfs_alloc_inode() 2024-11-23 23:20:12 +01:00
hfsplus hfsplus: fix to avoid false alarm of circular locking 2024-11-23 23:19:56 +01:00
hostfs Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hpfs Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hugetlbfs fs,hugetlb: fix NULL pointer dereference in hugetlbs_fill_super 2024-11-18 23:18:30 +01:00
incfs Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
iomap iomap: update ki_pos a little later in iomap_dio_complete 2024-11-23 23:22:00 +01:00
isofs isofs: handle CDs with bad root inode but good Joliet root directory 2024-11-19 09:23:14 +01:00
jbd2 Revert "ext4: fix incorrect tid assumption in __jbd2_log_wait_for_space()" 2024-11-24 00:23:04 +01:00
jffs2 jffs2: Fix potential illegal address access in jffs2_free_inode 2024-11-19 14:19:41 +01:00
jfs Revert "jfs: UBSAN: shift-out-of-bounds in dbFindBits" 2024-11-24 00:23:06 +01:00
kernfs fs/kernfs/dir: obey S_ISGID 2024-11-18 12:13:20 +01:00
lockd Revert "nfsd: stop setting ->pg_stats for unused stats" 2024-11-24 00:23:44 +01:00
minix Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
nfs nfs: Fix KMSAN warning in decode_getfattr_attrs() 2024-11-30 02:33:25 +01:00
nfs_common NFSD: Add an xdr_stream-based encoder for NFSv2/3 ACLs 2024-11-19 12:27:35 +01:00
nfsd Revert "NFSD: Refactor nfsd_reply_cache_free_locked()" 2024-11-24 00:23:45 +01:00
nilfs2 Revert "nilfs2: replace snprintf in show functions with sysfs_emit" 2024-11-24 00:23:37 +01:00
nls Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
notify Revert "fsnotify: clear PARENT_WATCHED flags lazily" 2024-11-24 00:23:48 +01:00
ntfs Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ocfs2 Revert "ocfs2: add bounds checking to ocfs2_xattr_find_entry()" 2024-11-24 00:23:33 +01:00
omfs Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
openpromfs openpromfs: finish conversion to the new mount API 2024-11-19 12:26:52 +01:00
orangefs orangefs: fix out-of-bounds fsid access 2024-11-19 14:19:41 +01:00
overlayfs Revert "namei: introduce struct renamedata" 2024-11-19 13:45:08 +01:00
proc Revert "proc: add config & param to block forcing mem writes" 2024-11-24 00:23:07 +01:00
pstore pstore/zone: Add a null pointer check to the psz_kmsg_read 2024-11-19 09:23:13 +01:00
qnx4 Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
qnx6 Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
quota quota: Remove BUG_ON from dqget() 2024-11-23 23:20:45 +01:00
ramfs Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
reiserfs Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
romfs Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
sdfat Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
squashfs Revert "Squashfs: sanity check symbolic link size" 2024-11-24 00:23:38 +01:00
sysfs fs: sysfs: Fix reference leak in sysfs_break_active_protection() 2024-11-19 11:32:23 +01:00
sysv sysv: don't call sb_bread() with pointers_lock held 2024-11-19 09:23:14 +01:00
tracefs Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ubifs ubifs: Set page uptodate in the correct place 2024-11-19 09:22:16 +01:00
udf Revert "udf: Limit file size to 4TB" 2024-11-24 00:23:46 +01:00
ufs Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
unicode Revert "unicode: Don't special case ignorable code points" 2024-11-24 00:23:00 +01:00
vboxsf vboxsf: Avoid an spurious warning if load_nls_xxx() fails 2024-11-19 09:22:46 +01:00
verity Revert "fs: add file and path permissions helpers" 2024-11-19 13:30:21 +01:00
xfs Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
zonefs zonefs: Improve error handling 2024-11-18 22:25:32 +01:00
aio.c fs/aio: Check IOCB_AIO_RW before the struct aio_kiocb conversion 2024-11-19 09:22:39 +01:00
anon_inodes.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
attr.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
bad_inode.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
binfmt_aout.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
binfmt_elf.c binfmt_misc: pass binfmt_misc flags to the interpreter 2024-11-23 23:20:49 +01:00
binfmt_elf_fdpic.c binfmt_misc: pass binfmt_misc flags to the interpreter 2024-11-23 23:20:49 +01:00
binfmt_em86.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
binfmt_flat.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
binfmt_misc.c binfmt_misc: pass binfmt_misc flags to the interpreter 2024-11-23 23:20:49 +01:00
binfmt_script.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
block_dev.c block: Don't invalidate pagecache for invalid falloc modes 2024-11-18 12:12:06 +01:00
buffer.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
char_dev.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
compat_binfmt_elf.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
coredump.c exec: Simplify unshare_files 2024-11-19 12:27:27 +01:00
d_path.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dax.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dcache.c fs: better handle deep ancestor chains in is_subdir() 2024-11-19 14:19:50 +01:00
dcookies.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
direct-io.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dlog_hook.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
drop_caches.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
eventfd.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
eventpoll.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
exec.c Revert "parisc: Fix stack start for ADDR_NO_RANDOMIZE personality" 2024-11-24 00:23:03 +01:00
fcntl.c Revert "fs: Fix file_set_fowner LSM hook inconsistencies" 2024-11-24 00:23:15 +01:00
fhandle.c do_sys_name_to_handle(): use kzalloc() to fix kernel-infoleak 2024-11-19 08:44:37 +01:00
file.c fix bitmap corruption on close_range() with CLOSE_RANGE_UNSHARE 2024-11-23 23:20:42 +01:00
file_table.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
filesystems.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fs-writeback.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fs_context.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fs_parser.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fs_pin.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fs_struct.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fs_types.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fsopen.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
init.c Revert "fs: add file and path permissions helpers" 2024-11-19 13:30:21 +01:00
inode.c Revert "vfs: fix race between evice_inodes() and find_inode()&iput()" 2024-11-24 00:23:15 +01:00
internal.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ioctl.c lsm: new security_file_ioctl_compat() hook 2024-11-18 12:12:58 +01:00
Kconfig NFSD: Remove CONFIG_NFSD_V3 2024-11-19 12:27:54 +01:00
Kconfig.binfmt Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
kernel_read_file.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
libfs.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
locks.c filelock: Fix fcntl/close race recovery compat path 2024-11-19 14:19:53 +01:00
Makefile Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mbcache.c mbcache: Speed up cache entry creation 2024-11-19 17:58:19 +01:00
mount.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mpage.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
namei.c Revert "namei: introduce struct renamedata" 2024-11-19 13:45:08 +01:00
namespace.c Revert "mount: warn only once about timestamp range expiration" 2024-11-24 00:23:31 +01:00
no-block.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
nsfs.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
open.c openat2: explicitly return -E2BIG for (usize > PAGE_SIZE) 2024-11-23 23:22:01 +01:00
pipe.c pipe: wakeup wr_wait after setting max_usage 2024-11-18 12:13:04 +01:00
pnode.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
pnode.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
posix_acl.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
proc_namespace.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
read_write.c security: samsung: defex_lsm: nuke 2024-06-15 16:20:49 -03:00
readdir.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
remap_range.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
select.c fs/select: rework stack allocation hack for clang 2024-11-19 08:44:37 +01:00
seq_file.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
signalfd.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
splice.c splice: don't generate zero-len segement bvecs 2024-11-19 17:42:24 +01:00
stack.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
stat.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
statfs.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
super.c Revert "fs: explicitly unregister per-superblock BDIs" 2024-11-24 00:23:31 +01:00
sync.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
timerfd.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
userfaultfd.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
utimes.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xattr.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00