From: Michael Kerrisk (man-pages) Date: Thu, 27 Apr 2017 11:54:11 +0000 (+0200) Subject: statx: correct error handling of NULL pathname X-Git-Tag: MMI-PSA29.97-13-9~5773 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=59372bbf3abd5b24a7f6f676a3968685c280f955;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git statx: correct error handling of NULL pathname The change in commit 1e2f82d1e9d1 ("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 Cc: David Howells Cc: Al Viro Cc: Eric Sandeen Signed-off-by: Linus Torvalds --- diff --git a/fs/stat.c b/fs/stat.c index 3d85747bd86e..a257b872a53d 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)