android_kernel_xiaomi_sm8350/net/sunrpc
Amir Goldstein 5463cfd833 fsnotify: fix fsnotify hooks in pseudo filesystems
commit 29044dae2e746949ad4b9cbdbfb248994d1dcdb4 upstream.

Commit 49246466a9 ("fsnotify: move fsnotify_nameremove() hook out of
d_delete()") moved the fsnotify delete hook before d_delete() so fsnotify
will have access to a positive dentry.

This allowed a race where opening the deleted file via cached dentry
is now possible after receiving the IN_DELETE event.

To fix the regression in pseudo filesystems, convert d_delete() calls
to d_drop() (see commit 46c46f8df9 ("devpts_pty_kill(): don't bother
with d_delete()") and move the fsnotify hook after d_drop().

Add a missing fsnotify_unlink() hook in nfsdfs that was found during
the audit of fsnotify hooks in pseudo filesystems.

Note that the fsnotify hooks in simple_recursive_removal() follow
d_invalidate(), so they require no change.

Link: https://lore.kernel.org/r/20220120215305.282577-2-amir73il@gmail.com
Reported-by: Ivan Delalande <colona@arista.com>
Link: https://lore.kernel.org/linux-fsdevel/YeNyzoDM5hP5LtGW@visor/
Fixes: 49246466a9 ("fsnotify: move fsnotify_nameremove() hook out of d_delete()")
Cc: stable@vger.kernel.org # v5.3+
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-02-01 17:24:34 +01:00
..
auth_gss rpc: fix gss_svc_init cleanup on failure 2021-09-22 12:26:33 +02:00
xprtrdma svcrdma: disable timeouts on rdma backchannel 2021-03-24 11:26:38 +01:00
addr.c net: sunrpc: interpret the return value of kstrtou32 correctly 2021-01-19 18:26:18 +01:00
auth_null.c
auth_unix.c
auth.c
backchannel_rqst.c
cache.c
clnt.c sunrpc: Fix misplaced barrier in call_decode 2021-05-19 10:08:27 +02:00
debugfs.c net: sunrpc: Fix 'snprintf' return value check in 'do_xprt_debugfs' 2020-12-30 11:51:16 +01:00
Kconfig
Makefile
netns.h
rpc_pipe.c fsnotify: fix fsnotify hooks in pseudo filesystems 2022-02-01 17:24:34 +01:00
rpcb_clnt.c
sched.c SUNRPC: Should wake up the privileged task firstly. 2021-07-14 16:53:05 +02:00
socklib.c
stats.c
sunrpc_syms.c
sunrpc.h
svc_xprt.c NFSD: Repair misuse of sv_lock in 5.10.16-rt30. 2021-03-24 11:26:38 +01:00
svc.c sunrpc: fix refcount leak for rpc auth modules 2021-03-24 11:26:39 +01:00
svcauth_unix.c
svcauth.c
svcsock.c
sysctl.c
timer.c
xdr.c
xprt.c SUNRPC: Partial revert of commit 6f9f17287e78 2021-11-17 09:48:50 +01:00
xprtmultipath.c
xprtsock.c sunrpc: fix xs_read_xdr_buf for partial pages receive 2020-12-30 11:51:26 +01:00