linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] statx: correct error handling of NULL pathname
@ 2017-04-27 11:54 Michael Kerrisk (man-pages)
  0 siblings, 0 replies; only message in thread
From: Michael Kerrisk (man-pages) @ 2017-04-27 11:54 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: mtk.manpages, David Howells, Al Viro, linux-man, Linux API,
	Eric Sandeen, Linux Kernel Mailing List, fstests, linux-fsdevel


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 https://lkml.org/lkml/2017/4/26/561, 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 <mtk.manpages@gmail.com>
---
 fs/stat.c | 2 --
 1 file changed, 2 deletions(-)

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;
 	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)
-- 
2.5.5

-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-04-27 11:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-27 11:54 [PATCH] statx: correct error handling of NULL pathname Michael Kerrisk (man-pages)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).