]> git.baikalelectronics.ru Git - kernel.git/commit
statx: correct error handling of NULL pathname
authorMichael Kerrisk (man-pages) <mtk.manpages@gmail.com>
Thu, 27 Apr 2017 11:54:11 +0000 (13:54 +0200)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 27 Apr 2017 17:45:09 +0000 (10:45 -0700)
commit9ca7bce2088c2b6ba833043fcfb8f15db4db4c2f
tree1b9fde933d8e9cbd7dec3c39521ca0cb16eed73d
parent71ab0367f368d38b65705644967ac707958ebe19
statx: correct error handling of NULL pathname

The change in commit 50b663bc9853 ("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 <mtk.manpages@gmail.com>
Cc: David Howells <dhowells@redhat.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Eric Sandeen <sandeen@sandeen.net>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/stat.c