diff options
Diffstat (limited to 'fs/stat.c')
-rw-r--r-- | fs/stat.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -294,15 +294,16 @@ SYSCALL_DEFINE4(readlinkat, int, dfd, const char __user *, pathname, | |||
294 | { | 294 | { |
295 | struct path path; | 295 | struct path path; |
296 | int error; | 296 | int error; |
297 | int empty = 0; | ||
297 | 298 | ||
298 | if (bufsiz <= 0) | 299 | if (bufsiz <= 0) |
299 | return -EINVAL; | 300 | return -EINVAL; |
300 | 301 | ||
301 | error = user_path_at(dfd, pathname, LOOKUP_EMPTY, &path); | 302 | error = user_path_at_empty(dfd, pathname, LOOKUP_EMPTY, &path, &empty); |
302 | if (!error) { | 303 | if (!error) { |
303 | struct inode *inode = path.dentry->d_inode; | 304 | struct inode *inode = path.dentry->d_inode; |
304 | 305 | ||
305 | error = -EINVAL; | 306 | error = empty ? -ENOENT : -EINVAL; |
306 | if (inode->i_op->readlink) { | 307 | if (inode->i_op->readlink) { |
307 | error = security_inode_readlink(path.dentry); | 308 | error = security_inode_readlink(path.dentry); |
308 | if (!error) { | 309 | if (!error) { |