statx: correct error handling of NULL pathname
diff mbox

Message ID
State New
Headers show

Commit Message

Michael Kerrisk (man-pages) April 27, 2017, 11:54 a.m. UTC
The change in 1e2f82d1e9d1 to error on a NULL pathname to statx()
is inconsistent.  It results in the error EINVAL for a NULL pathname.
Consistent with similar APIs (fchownat(), fstatat(), linkat()),
the error should be EFAULT.

The solution is simply to remove the EINVAL check. As I already
pointed out in, user_path_at*()
and filename_lookup() will handle the NULL pathname as per
the other APIs, to correctly produce the error EFAULT.

Signed-off-by: Michael Kerrisk <>
 fs/stat.c | 2 --
 1 file changed, 2 deletions(-)

diff mbox

diff --git a/fs/stat.c b/fs/stat.c
index 3d85747..a257b87 100644
--- a/fs/stat.c
+++ b/fs/stat.c
@@ -567,8 +567,6 @@  SYSCALL_DEFINE5(statx,
 		return -EINVAL;
 		return -EINVAL;
-	if (!filename)
-		return -EINVAL;
 	error = vfs_statx(dfd, filename, flags, &stat, mask);
 	if (error)