]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-5.15/fanotify-support-null-inode-event-in-fanotify_dfid_i.patch
Fixes for 5.15
[thirdparty/kernel/stable-queue.git] / queue-5.15 / fanotify-support-null-inode-event-in-fanotify_dfid_i.patch
1 From 4c14e8ef2484b86cee2467ce880b9e91166510b1 Mon Sep 17 00:00:00 2001
2 From: Sasha Levin <sashal@kernel.org>
3 Date: Mon, 25 Oct 2021 16:27:28 -0300
4 Subject: fanotify: Support null inode event in fanotify_dfid_inode
5
6 From: Gabriel Krisman Bertazi <krisman@collabora.com>
7
8 [ Upstream commit 12f47bf0f0990933d95d021d13d31bda010648fd ]
9
10 FAN_FS_ERROR doesn't support DFID, but this function is still called for
11 every event. The problem is that it is not capable of handling null
12 inodes, which now can happen in case of superblock error events. For
13 this case, just returning dir will be enough.
14
15 Link: https://lore.kernel.org/r/20211025192746.66445-14-krisman@collabora.com
16 Reviewed-by: Amir Goldstein <amir73il@gmail.com>
17 Reviewed-by: Jan Kara <jack@suse.cz>
18 Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com>
19 Signed-off-by: Jan Kara <jack@suse.cz>
20 Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
21 ---
22 fs/notify/fanotify/fanotify.c | 2 +-
23 1 file changed, 1 insertion(+), 1 deletion(-)
24
25 diff --git a/fs/notify/fanotify/fanotify.c b/fs/notify/fanotify/fanotify.c
26 index c620b4f6fe123..397ee623ff1e8 100644
27 --- a/fs/notify/fanotify/fanotify.c
28 +++ b/fs/notify/fanotify/fanotify.c
29 @@ -452,7 +452,7 @@ static struct inode *fanotify_dfid_inode(u32 event_mask, const void *data,
30 if (event_mask & ALL_FSNOTIFY_DIRENT_EVENTS)
31 return dir;
32
33 - if (S_ISDIR(inode->i_mode))
34 + if (inode && S_ISDIR(inode->i_mode))
35 return inode;
36
37 return dir;
38 --
39 2.43.0
40