[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140924152523.GC7441@tucsk.piliscsaba.szeredi.hu>
Date: Wed, 24 Sep 2014 17:25:23 +0200
From: Miklos Szeredi <miklos@...redi.hu>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Al Viro <viro@...IV.linux.org.uk>,
"Aneesh Kumar K.V" <aneesh.kumar@...ux.vnet.ibm.com>,
linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org
Subject: [PATCH] vfs: fix linkat error for unprivileged AT_EMPTY_PATH
From: Miklos Szeredi <mszeredi@...e.cz>
Return proper error value for linkat(..., AT_EMPTY_PATH) without enough
privileges.
I guess ENOENT was used here, because without AT_EMPTY_PATH that's what
we'd return for an empty path. But it is wrong for AT_EMPTY_PATH, since we
might not even be passing an empty path, we are simply complaining about
lack of privs for which EPERM is the proper error.
Fixes: 11a7b371b64e ("fs: allow AT_EMPTY_PATH in linkat()...")
Signed-off-by: Miklos Szeredi <mszeredi@...e.cz>
Cc: Aneesh Kumar K.V <aneesh.kumar@...ux.vnet.ibm.com>
Cc: stable@...r.kernel.org # 2.6.39+
---
fs/namei.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -3957,7 +3957,7 @@ SYSCALL_DEFINE5(linkat, int, olddfd, con
*/
if (flags & AT_EMPTY_PATH) {
if (!capable(CAP_DAC_READ_SEARCH))
- return -ENOENT;
+ return -EPERM;
how = LOOKUP_EMPTY;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists