linux-stable/fs
Pan Bian 7ee29facd8 nilfs2: fix potential use after free in nilfs_gccache_submit_read_data()
In nilfs_gccache_submit_read_data(), brelse(bh) is called to drop the
reference count of bh when the call to nilfs_dat_translate() fails.  If
the reference count hits 0 and its owner page gets unlocked, bh may be
freed.  However, bh->b_page is dereferenced to put the page after that,
which may result in a use-after-free bug.  This patch moves the release
operation after unlocking and putting the page.

NOTE: The function in question is only called in GC, and in combination
with current userland tools, address translation using DAT does not occur
in that function, so the code path that causes this issue will not be
executed.  However, it is possible to run that code path by intentionally
modifying the userland GC library or by calling the GC ioctl directly.

[konishi.ryusuke@gmail.com: NOTE added to the commit log]
Link: https://lkml.kernel.org/r/1543201709-53191-1-git-send-email-bianpan2016@163.com
Link: https://lkml.kernel.org/r/20230921141731.10073-1-konishi.ryusuke@gmail.com
Fixes: a3d93f709e ("nilfs2: block cache for garbage collection")
Signed-off-by: Pan Bian <bianpan2016@163.com>
Reported-by: Ferry Meng <mengferry@linux.alibaba.com>
Closes: https://lkml.kernel.org/r/20230818092022.111054-1-mengferry@linux.alibaba.com
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Tested-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2023-09-29 17:20:46 -07:00
..
9p
adfs
affs
afs
autofs
befs
bfs
btrfs for-6.6-rc1-tag 2023-09-12 11:28:00 -07:00
cachefiles
ceph Mixed with some fixes and cleanups, this brings in reasonably complete 2023-09-06 12:10:15 -07:00
coda
configfs
cramfs
crypto
debugfs Char/Misc driver changes for 6.6-rc1 2023-09-01 09:53:54 -07:00
devpts
dlm
ecryptfs
efivarfs efivarfs: fix statfs() on efivarfs 2023-09-11 09:10:02 +00:00
efs
erofs
exfat
exportfs
ext2
ext4 Regression and bug fixes for ext4. 2023-09-17 10:33:53 -07:00
f2fs f2fs update for 6.6-rc1 2023-09-02 15:37:59 -07:00
fat
freevxfs
fscache
fuse fuse update for 6.6 2023-09-05 12:45:55 -07:00
gfs2 gfs2 fixes 2023-09-05 13:00:28 -07:00
hfs
hfsplus
hostfs
hpfs
hugetlbfs
iomap
isofs
jbd2 Regression and bug fixes for ext4. 2023-09-17 10:33:53 -07:00
jffs2
jfs A few small fixes 2023-08-31 15:25:01 -07:00
kernfs Driver core changes for 6.6-rc1 2023-09-01 09:43:18 -07:00
lockd
minix
netfs
nfs NFS CLient Updates for Linux 6.6 2023-08-31 15:36:41 -07:00
nfs_common
nfsd nfsd-6.6 fixes: 2023-09-15 16:48:44 -07:00
nilfs2 nilfs2: fix potential use after free in nilfs_gccache_submit_read_data() 2023-09-29 17:20:46 -07:00
nls
notify
ntfs
ntfs3 ntfs3: drop inode references in ntfs_put_super() 2023-09-07 10:23:37 -07:00
ocfs2 Many ext4 and jbd2 cleanups and bug fixes for v6.6-rc1. 2023-08-31 15:18:15 -07:00
omfs
openpromfs
orangefs
overlayfs ovl: fix incorrect fdput() on aio completion 2023-09-04 18:27:38 +03:00
proc proc: nommu: fix empty /proc/<pid>/maps 2023-09-19 13:21:34 -07:00
pstore pstore fix for v6.6-rc1 2023-09-02 10:45:17 -07:00
qnx4
qnx6
quota
ramfs
reiserfs
romfs
smb three small SMB3 client fixes, one to improve a null check and two minor cleanup 2023-09-17 10:41:42 -07:00
squashfs
sysfs
sysv
tracefs tracefs/eventfs: Use list_for_each_srcu() in dcache_dir_open_wrapper() 2023-09-11 22:05:02 -04:00
ubifs
udf
ufs
unicode
vboxsf
verity
xfs
zonefs
aio.c
anon_inodes.c
attr.c
bad_inode.c
binfmt_elf_fdpic.c fs: binfmt_elf_efpic: fix personality for ELF-FDPIC 2023-09-29 17:20:45 -07:00
binfmt_elf_test.c
binfmt_elf.c
binfmt_flat.c
binfmt_misc.c
binfmt_script.c
buffer.c
char_dev.c
compat_binfmt_elf.c
coredump.c
d_path.c
dax.c
dcache.c
direct-io.c
drop_caches.c
eventfd.c
eventpoll.c
exec.c
fcntl.c
fhandle.c
file_table.c
file.c
filesystems.c
fs_context.c
fs_parser.c
fs_pin.c
fs_struct.c
fs_types.c
fs-writeback.c
fsopen.c
init.c
inode.c
internal.h
ioctl.c
Kconfig
Kconfig.binfmt
kernel_read_file.c
libfs.c Many ext4 and jbd2 cleanups and bug fixes for v6.6-rc1. 2023-08-31 15:18:15 -07:00
locks.c NFSD 6.6 Release Notes 2023-08-31 15:32:18 -07:00
Makefile
mbcache.c
mnt_idmapping.c
mount.h
mpage.c
namei.c
namespace.c
nsfs.c
open.c
pipe.c
pnode.c
pnode.h
posix_acl.c
proc_namespace.c
read_write.c
readdir.c
remap_range.c
select.c
seq_file.c
signalfd.c
splice.c
stack.c
stat.c stat: remove no-longer-used helper macros 2023-09-17 10:46:12 -07:00
statfs.c
super.c
sync.c
sysctls.c
timerfd.c
userfaultfd.c
utimes.c
xattr.c