Message ID | 20241007130825.10326-2-xry111@xry111.site (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | vfs: fstatat, statx: Consistently accept AT_EMPTY_PATH and NULL path | expand |
diff --git a/fs/stat.c b/fs/stat.c index 41e598376d7e..ed9d4fd8ba2c 100644 --- a/fs/stat.c +++ b/fs/stat.c @@ -334,6 +334,7 @@ int vfs_fstatat(int dfd, const char __user *filename, * If AT_EMPTY_PATH is set, we expect the common case to be that * empty path, and avoid doing all the extra pathname work. */ + flags &= ~AT_NO_AUTOMOUNT; if (flags == AT_EMPTY_PATH && vfs_empty_path(dfd, filename)) return vfs_fstat(dfd, stat);
Since Linux 4.11 AT_NO_AUTOMOUNT is implied for fstatat. So we should support this like fstatat(..., NULL, AT_EMPTY_PATH, ...) for consistency. Also note that statx(..., NULL, AT_EMPTY_PATH | AT_NO_AUTOMOUNT) is already supported. Fixes: 27a2d0cb2f38 ("stat: use vfs_empty_path() helper") Cc: stable@vger.kernel.org Signed-off-by: Xi Ruoyao <xry111@xry111.site> --- fs/stat.c | 1 + 1 file changed, 1 insertion(+)