linux/fs
Jan Kara 145f54ea33 inotify: Avoid reporting event with invalid wd
commit c915d8f591 upstream.

When inotify_freeing_mark() races with inotify_handle_inode_event() it
can happen that inotify_handle_inode_event() sees that i_mark->wd got
already reset to -1 and reports this value to userspace which can
confuse the inotify listener. Avoid the problem by validating that wd is
sensible (and pretend the mark got removed before the event got
generated otherwise).

CC: stable@vger.kernel.org
Fixes: 7e790dd5fc ("inotify: fix error paths in inotify_update_watch")
Message-Id: <20230424163219.9250-1-jack@suse.cz>
Reported-by: syzbot+4a06d4373fd52f0b2f9c@syzkaller.appspotmail.com
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-05-17 11:53:44 +02:00
..
9p
adfs
affs
afs afs: Avoid endless loop if file is larger than expected 2023-05-11 23:03:38 +09:00
autofs
befs
bfs
btrfs btrfs: zoned: fix full zone super block reading on ZNS 2023-05-17 11:53:43 +02:00
cachefiles
ceph ceph: fix potential use-after-free bug when trimming caps 2023-05-11 23:03:05 +09:00
cifs cifs: release leases for deferred close handles when freezing 2023-05-17 11:53:43 +02:00
coda coda: Avoid partial allocation of sig_inputArgs 2023-03-10 09:33:52 +01:00
configfs
cramfs fs/cramfs/inode.c: initialize file_ra_state 2023-03-10 09:34:09 +01:00
crypto blk-crypto: add a blk_crypto_config_supported_natively helper 2023-05-11 23:03:00 +09:00
debugfs
devpts
dlm fs: dlm: fix race setting stop tx flag 2023-03-17 08:50:19 +01:00
ecryptfs
efivarfs
efs
erofs erofs: fix potential overflow calculating xattr_isize 2023-05-11 23:03:07 +09:00
exfat exfat: fix inode->i_blocks for non-512 byte sector size device 2023-03-10 09:34:08 +01:00
exportfs
ext2
ext4 ext4: fix use-after-free read in ext4_find_extent for bigalloc + inline 2023-05-11 23:03:36 +09:00
f2fs f2fs: fix to check return value of inc_valid_block_count() 2023-05-11 23:03:23 +09:00
fat
freevxfs
fscache
fuse fuse: always revalidate rename target dentry 2023-04-26 14:28:42 +02:00
gfs2 gfs2: Improve gfs2_make_fs_rw error handling 2023-03-10 09:33:59 +01:00
hfs hfs: fix missing hfs_bnode_get() in __hfs_bnode_create 2023-03-10 09:34:07 +01:00
hfsplus fs: hfsplus: fix UAF issue in hfsplus_put_super 2023-03-10 09:34:07 +01:00
hostfs
hpfs
hugetlbfs
iomap
isofs
jbd2 jdb2: Don't refuse invalidation of already invalidated buffers 2023-05-11 23:03:23 +09:00
jffs2 jffs2: correct logic when creating a hole in jffs2_write_begin 2023-03-22 13:33:53 +01:00
jfs fs/jfs: fix shift exponent db_agl2size negative 2023-03-11 13:55:16 +01:00
kernfs
ksmbd ksmbd: fix deadlock in ksmbd_find_crypto_ctx() 2023-05-11 23:03:04 +09:00
lockd lockd: set file_lock start and end when decoding nlm4 testargs 2023-03-30 12:49:23 +02:00
minix
netfs
nfs NFSv4.1: Always send a RECLAIM_COMPLETE after establishing lease 2023-05-11 23:03:34 +09:00
nfs_common
nfsd NFSD: callback request does not use correct credential for AUTH_SYS 2023-04-13 16:55:23 +02:00
nilfs2 nilfs2: fix infinite loop in nilfs_mdt_get_block() 2023-05-11 23:03:39 +09:00
nls
notify inotify: Avoid reporting event with invalid wd 2023-05-17 11:53:44 +02:00
ntfs
ntfs3 fs/ntfs3: Fix null-ptr-deref on inode->i_op in ntfs_lookup() 2023-05-17 11:53:29 +02:00
ocfs2 ocfs2: fix data corruption after failed write 2023-03-22 13:34:02 +01:00
omfs
openpromfs
orangefs
overlayfs
proc
pstore pstore: Revert pmsg_lock back to a normal mutex 2023-05-11 23:03:27 +09:00
qnx4
qnx6
quota
ramfs
reiserfs reiserfs: Add security prefix to xattr name in reiserfs_security_write() 2023-05-11 23:03:02 +09:00
romfs
smbfs_common
squashfs
sysfs
sysv
tracefs
ubifs ubifs: Fix memory leak in do_rename 2023-05-11 23:03:05 +09:00
udf udf: Fix off-by-one error when discarding preallocation 2023-03-17 08:50:19 +01:00
ufs
unicode
vboxsf
verity fsverity: don't drop pagecache at end of FS_IOC_ENABLE_VERITY 2023-04-06 12:10:34 +02:00
xfs xfs: don't consider future format versions valid 2023-05-11 23:03:05 +09:00
zonefs zonefs: Always invalidate last cached page on append write 2023-04-06 12:10:52 +02:00
aio.c
anon_inodes.c
attr.c attr: use consistent sgid stripping checks 2023-03-03 11:52:25 +01:00
bad_inode.c
binfmt_elf_fdpic.c
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 fs: prevent out-of-bounds array speculation when closing a file descriptor 2023-03-17 08:50:13 +01:00
filesystems.c
fs_context.c
fs_parser.c
fs_pin.c
fs_struct.c
fs_types.c
fs-writeback.c writeback: fix call of incorrect macro 2023-05-17 11:53:33 +02:00
fsopen.c
init.c
inode.c attr: use consistent sgid stripping checks 2023-03-03 11:52:25 +01:00
internal.h attr: use consistent sgid stripping checks 2023-03-03 11:52:25 +01:00
ioctl.c
Kconfig
Kconfig.binfmt
kernel_read_file.c
libfs.c
locks.c filelocks: use mount idmapping for setlease permission check 2023-03-17 08:50:32 +01:00
Makefile fs: fix sysctls.c built 2023-05-11 23:03:01 +09:00
mbcache.c
mount.h
mpage.c
namei.c
namespace.c fs: drop peer group ids under namespace lock 2023-04-13 16:55:33 +02:00
no-block.c
nsfs.c
open.c fs: Use CHECK_DATA_CORRUPTION() when kernel bugs are detected 2023-03-10 09:33:46 +01:00
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
statfs.c
super.c fscrypt: destroy keyring after security_sb_delete() 2023-03-30 12:49:23 +02:00
sync.c
sysctls.c
timerfd.c
userfaultfd.c Revert "userfaultfd: don't fail on unrecognized features" 2023-04-26 14:28:37 +02:00
utimes.c
xattr.c