linux-stable/fs/notify
Jan Kara fb32949984 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 13:58:59 +02:00
..
dnotify dnotify: use fsnotify group lock helpers 2022-04-25 14:37:34 +02:00
fanotify Merge tag 'fsnotify-for_v6.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs 2022-10-07 08:28:50 -07:00
inotify inotify: Avoid reporting event with invalid wd 2023-05-17 13:58:59 +02:00
Kconfig treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
Makefile
fdinfo.c fanotify: prepare for setting event flags in ignore mask 2022-07-01 14:51:13 +02:00
fdinfo.h
fsnotify.c fsnotify: Fix comment typo 2022-07-26 13:38:47 +02:00
fsnotify.h fsnotify: remove unused declaration 2022-09-09 11:40:03 +02:00
group.c fsnotify: create helpers for group mark_mutex lock 2022-04-25 14:37:22 +02:00
mark.c fsnotify: allow adding an inode mark without pinning inode 2022-04-25 14:42:45 +02:00
notification.c fsnotify: Pass group argument to free_event 2021-10-27 12:34:18 +02:00