]> git.karo-electronics.de Git - karo-tx-linux.git/commit
readlinkat: ensure we return ENOENT for the empty pathname for normal lookups
authorAndy Whitcroft <apw@canonical.com>
Mon, 24 Oct 2011 14:53:27 +0000 (01:53 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Tue, 25 Oct 2011 08:47:33 +0000 (19:47 +1100)
commit412b96255b34eb3817189bf7561662e86953d177
treeef08df2dd46d94eac87ffe8d1dbedbbf5325c257
parenta4320b0e9c56e4544eec496efba3d1f38a9e174e
readlinkat: ensure we return ENOENT for the empty pathname for normal lookups

Since the commit below which added O_PATH support to the *at() calls, the
error return for readlink/readlinkat for the empty pathname has switched
from ENOENT to EINVAL:

  commit 65cfc6722361570bfe255698d9cd4dccaf47570d
  Author: Al Viro <viro@zeniv.linux.org.uk>
  Date:   Sun Mar 13 15:56:26 2011 -0400

    readlinkat(), fchownat() and fstatat() with empty relative pathnames

This is both unexpected for userspace and makes readlink/readlinkat
inconsistant with all other interfaces; and inconsistant with our stated
return for these pathnames.

As the readlinkat call does not have a flags parameter we cannot use the
AT_EMPTY_PATH approach used in the other calls.  Therefore expose whether
the original path is infact entry via a new user_path_at_empty() path
lookup function.  Use this to determine whether to default to EINVAL or
ENOENT for failures.

BugLink: http://bugs.launchpad.net/bugs/817187
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: <stable@kernel.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
fs/namei.c
fs/stat.c
include/linux/namei.h