Skip to content

Commit 59372bb

Browse files
mkerrisktorvalds
authored andcommitted
statx: correct error handling of NULL pathname
The change in commit 1e2f82d ("statx: Kill fd-with-NULL-path support in favour of AT_EMPTY_PATH") to error on a NULL pathname to statx() is inconsistent. It results in the error EINVAL for a NULL pathname. Other system calls with similar APIs (fchownat(), fstatat(), linkat()), return EFAULT. The solution is simply to remove the EINVAL check. As I already pointed out in [1], user_path_at*() and filename_lookup() will handle the NULL pathname as per the other APIs, to correctly produce the error EFAULT. [1] https://lkml.org/lkml/2017/4/26/561 Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com> Cc: David Howells <dhowells@redhat.com> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Eric Sandeen <sandeen@sandeen.net> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent f832460 commit 59372bb

File tree

1 file changed

+0
-2
lines changed

1 file changed

+0
-2
lines changed

fs/stat.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -567,8 +567,6 @@ SYSCALL_DEFINE5(statx,
567567
return -EINVAL;
568568
if ((flags & AT_STATX_SYNC_TYPE) == AT_STATX_SYNC_TYPE)
569569
return -EINVAL;
570-
if (!filename)
571-
return -EINVAL;
572570

573571
error = vfs_statx(dfd, filename, flags, &stat, mask);
574572
if (error)

0 commit comments

Comments
 (0)