From: "Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: mtk.manpages@gmail.com, David Howells <dhowells@redhat.com>,
Al Viro <viro@zeniv.linux.org.uk>,
linux-man <linux-man@vger.kernel.org>,
Linux API <linux-api@vger.kernel.org>,
Eric Sandeen <sandeen@sandeen.net>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
fstests <fstests@vger.kernel.org>,
linux-fsdevel <linux-fsdevel@vger.kernel.org>,
Michael Kerrisk <mtk.manpages@gmail.com>,
hch@infradead.org
Subject: [PATCH] statx: correct error handling of NULL pathname
Date: Thu, 27 Apr 2017 13:54:11 +0200 [thread overview]
Message-ID: <d10d318c-7461-96fb-952b-c246811a8228@gmail.com> (raw)
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/
reply other threads:[~2017-04-27 11:54 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d10d318c-7461-96fb-952b-c246811a8228@gmail.com \
--to=mtk.manpages@gmail.com \
--cc=dhowells@redhat.com \
--cc=fstests@vger.kernel.org \
--cc=hch@infradead.org \
--cc=linux-api@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-man@vger.kernel.org \
--cc=sandeen@sandeen.net \
--cc=torvalds@linux-foundation.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).