summaryrefslogtreecommitdiffstats
path: root/fs/lockd/svcsubs.c
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2022-01-28 22:57:01 +0300
committerJan Kara <jack@suse.cz>2022-02-01 12:52:07 +0100
commitee12595147ac1fbfb5bcb23837e26dd58d94b15d (patch)
tree23b335c261ec5a532107c5c69fe95348bd57db83 /fs/lockd/svcsubs.c
parent26291c54e111ff6ba87a164d85d4a4e134b7315c (diff)
downloadlinux-stable-ee12595147ac1fbfb5bcb23837e26dd58d94b15d.tar.gz
linux-stable-ee12595147ac1fbfb5bcb23837e26dd58d94b15d.tar.bz2
linux-stable-ee12595147ac1fbfb5bcb23837e26dd58d94b15d.zip
fanotify: Fix stale file descriptor in copy_event_to_user()
This code calls fd_install() which gives the userspace access to the fd. Then if copy_info_records_to_user() fails it calls put_unused_fd(fd) but that will not release it and leads to a stale entry in the file descriptor table. Generally you can't trust the fd after a call to fd_install(). The fix is to delay the fd_install() until everything else has succeeded. Fortunately it requires CAP_SYS_ADMIN to reach this code so the security impact is less. Fixes: f644bc449b37 ("fanotify: fix copy_event_to_user() fid error clean up") Link: https://lore.kernel.org/r/20220128195656.GA26981@kili Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Mathias Krause <minipli@grsecurity.net> Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/lockd/svcsubs.c')
0 files changed, 0 insertions, 0 deletions