summaryrefslogtreecommitdiffstats
path: root/fs/namei.c
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@redhat.com>2016-12-09 16:45:04 +0100
committerMiklos Szeredi <mszeredi@redhat.com>2016-12-09 16:45:04 +0100
commitfd4a0edf2a3d781c6ae07d2810776ce22302ee1c (patch)
tree4ccfd06bc5705bc2903667043e4f9fdadb568d1b /fs/namei.c
parent2a07a1f5abba308729bd082dce4d035365165d85 (diff)
downloadop-kernel-dev-fd4a0edf2a3d781c6ae07d2810776ce22302ee1c.zip
op-kernel-dev-fd4a0edf2a3d781c6ae07d2810776ce22302ee1c.tar.gz
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/namei.c')
-rw-r--r--fs/namei.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 5b4eed2..12a4159 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -4669,6 +4669,27 @@ int generic_readlink(struct dentry *dentry, char __user *buffer, int buflen)
EXPORT_SYMBOL(generic_readlink);
/**
+ * vfs_readlink - copy symlink body into userspace buffer
+ * @dentry: dentry on which to get symbolic link
+ * @buffer: user memory pointer
+ * @buflen: size of buffer
+ *
+ * Does not touch atime. That's up to the caller if necessary
+ *
+ * Does not call security hook.
+ */
+int vfs_readlink(struct dentry *dentry, char __user *buffer, int buflen)
+{
+ struct inode *inode = d_inode(dentry);
+
+ if (!inode->i_op->readlink)
+ return -EINVAL;
+
+ return inode->i_op->readlink(dentry, buffer, buflen);
+}
+EXPORT_SYMBOL(vfs_readlink);
+
+/**
* vfs_get_link - get symlink body
* @dentry: dentry on which to get symbolic link
* @done: caller needs to free returned data with this
OpenPOWER on IntegriCloud