]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
fanotify: Support null inode event in fanotify_dfid_inode
authorGabriel Krisman Bertazi <krisman@collabora.com>
Mon, 25 Oct 2021 19:27:28 +0000 (16:27 -0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 10 Apr 2024 14:18:50 +0000 (16:18 +0200)
[ Upstream commit 12f47bf0f0990933d95d021d13d31bda010648fd ]

FAN_FS_ERROR doesn't support DFID, but this function is still called for
every event.  The problem is that it is not capable of handling null
inodes, which now can happen in case of superblock error events.  For
this case, just returning dir will be enough.

Link: https://lore.kernel.org/r/20211025192746.66445-14-krisman@collabora.com
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
fs/notify/fanotify/fanotify.c

index c620b4f6fe123527be1d4dc0461a2d60e152987d..397ee623ff1e866f03bec750913b6b4825163a45 100644 (file)
@@ -452,7 +452,7 @@ static struct inode *fanotify_dfid_inode(u32 event_mask, const void *data,
        if (event_mask & ALL_FSNOTIFY_DIRENT_EVENTS)
                return dir;
 
-       if (S_ISDIR(inode->i_mode))
+       if (inode && S_ISDIR(inode->i_mode))
                return inode;
 
        return dir;