diff options
author | Miklos Szeredi <mszeredi@redhat.com> | 2016-12-09 10:45:04 -0500 |
---|---|---|
committer | Miklos Szeredi <mszeredi@redhat.com> | 2016-12-09 10:45:04 -0500 |
commit | fd4a0edf2a3d781c6ae07d2810776ce22302ee1c (patch) | |
tree | 4ccfd06bc5705bc2903667043e4f9fdadb568d1b /fs/stat.c | |
parent | 2a07a1f5abba308729bd082dce4d035365165d85 (diff) |
vfs: replace calling i_op->readlink with vfs_readlink()
Also check d_is_symlink() in callers instead of inode->i_op->readlink
because following patches will allow NULL ->readlink for symlinks.
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Diffstat (limited to 'fs/stat.c')
-rw-r--r-- | fs/stat.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -329,12 +329,14 @@ retry: | |||
329 | struct inode *inode = d_backing_inode(path.dentry); | 329 | struct inode *inode = d_backing_inode(path.dentry); |
330 | 330 | ||
331 | error = empty ? -ENOENT : -EINVAL; | 331 | error = empty ? -ENOENT : -EINVAL; |
332 | if (inode->i_op->readlink) { | 332 | /* |
333 | * AFS mountpoints allow readlink(2) but are not symlinks | ||
334 | */ | ||
335 | if (d_is_symlink(path.dentry) || inode->i_op->readlink) { | ||
333 | error = security_inode_readlink(path.dentry); | 336 | error = security_inode_readlink(path.dentry); |
334 | if (!error) { | 337 | if (!error) { |
335 | touch_atime(&path); | 338 | touch_atime(&path); |
336 | error = inode->i_op->readlink(path.dentry, | 339 | error = vfs_readlink(path.dentry, buf, bufsiz); |
337 | buf, bufsiz); | ||
338 | } | 340 | } |
339 | } | 341 | } |
340 | path_put(&path); | 342 | path_put(&path); |