]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
kernfs: do not call fsnotify() with name without a parent
authorAmir Goldstein <amir73il@gmail.com>
Wed, 8 Jul 2020 11:11:40 +0000 (14:11 +0300)
committerThadeu Lima de Souza Cascardo <cascardo@canonical.com>
Fri, 4 Sep 2020 19:29:09 +0000 (16:29 -0300)
BugLink: https://bugs.launchpad.net/bugs/1892417
[ Upstream commit 9991bb84b27a2594187898f261866cfc50255454 ]

When creating an FS_MODIFY event on inode itself (not on parent)
the file_name argument should be NULL.

The change to send a non NULL name to inode itself was done on purpuse
as part of another commit, as Tejun writes: "...While at it, supply the
target file name to fsnotify() from kernfs_node->name.".

But this is wrong practice and inconsistent with inotify behavior when
watching a single file.  When a child is being watched (as opposed to the
parent directory) the inotify event should contain the watch descriptor,
but not the file name.

Fixes: df6a58c5c5aa ("kernfs: don't depend on d_find_any_alias()...")
Link: https://lore.kernel.org/r/20200708111156.24659-5-amir73il@gmail.com
Acked-by: Tejun Heo <tj@kernel.org>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kelsey Skunberg <kelsey.skunberg@canonical.com>
fs/kernfs/file.c

index e8c792b4961664688c624469d8326b5f6d799699..c35bbaa194862ad20f18afd58d1b2f6c4d7a7260 100644 (file)
@@ -912,7 +912,7 @@ repeat:
                }
 
                fsnotify(inode, FS_MODIFY, inode, FSNOTIFY_EVENT_INODE,
-                        &name, 0);
+                        NULL, 0);
                iput(inode);
        }