]> git.baikalelectronics.ru Git - kernel.git/commit
fanotify: fix copy_event_to_user() fid error clean up
authorMatthew Bobrowski <repnop@google.com>
Fri, 11 Jun 2021 03:32:06 +0000 (13:32 +1000)
committerJan Kara <jack@suse.cz>
Mon, 14 Jun 2021 10:16:37 +0000 (12:16 +0200)
commitde5b8a7e1e3897a9396f6339b3e206f7283a222c
tree998f4bc2b06fce19adfd263dc85e4d53ccaa6cea
parent7f6864a054c90434e53660b2e80755898468c094
fanotify: fix copy_event_to_user() fid error clean up

Ensure that clean up is performed on the allocated file descriptor and
struct file object in the event that an error is encountered while copying
fid info objects. Currently, we return directly to the caller when an error
is experienced in the fid info copying helper, which isn't ideal given that
the listener process could be left with a dangling file descriptor in their
fdtable.

Fixes: 36f05ebd99c9 ("fanotify: copy event fid info to user")
Fixes: fc9aabc0d0c9 ("fanotify: report name info for FAN_DIR_MODIFY event")
Link: https://lore.kernel.org/linux-fsdevel/YMKv1U7tNPK955ho@google.com/T/#m15361cd6399dad4396aad650de25dbf6b312288e
Link: https://lore.kernel.org/r/1ef8ae9100101eb1a91763c516c2e9a3a3b112bd.1623376346.git.repnop@google.com
Signed-off-by: Matthew Bobrowski <repnop@google.com>
Signed-off-by: Jan Kara <jack@suse.cz>
fs/notify/fanotify/fanotify_user.c