Skip to content

Commit

Permalink
statx: correct error handling of NULL pathname
Browse files Browse the repository at this point in the history
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 <[email protected]>
Cc: David Howells <[email protected]>
Cc: Al Viro <[email protected]>
Cc: Eric Sandeen <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
mkerrisk authored and torvalds committed Apr 27, 2017
1 parent f832460 commit 59372bb
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions fs/stat.c
Original file line number Diff line number Diff line change
Expand Up @@ -567,8 +567,6 @@ SYSCALL_DEFINE5(statx,
return -EINVAL;
if ((flags & AT_STATX_SYNC_TYPE) == AT_STATX_SYNC_TYPE)
return -EINVAL;
if (!filename)
return -EINVAL;

error = vfs_statx(dfd, filename, flags, &stat, mask);
if (error)
Expand Down

0 comments on commit 59372bb

Please sign in to comment.