aboutsummaryrefslogtreecommitdiffstats
path: root/fs/namei.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/namei.c')
-rw-r--r--fs/namei.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 617de9e9967b..4fb52f0ca5cb 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -4297,11 +4297,9 @@ SYSCALL_DEFINE2(rename, const char __user *, oldname, const char __user *, newna
4297 return sys_renameat(AT_FDCWD, oldname, AT_FDCWD, newname); 4297 return sys_renameat(AT_FDCWD, oldname, AT_FDCWD, newname);
4298} 4298}
4299 4299
4300int vfs_readlink(struct dentry *dentry, char __user *buffer, int buflen, const char *link) 4300int readlink_copy(char __user *buffer, int buflen, const char *link)
4301{ 4301{
4302 int len; 4302 int len = PTR_ERR(link);
4303
4304 len = PTR_ERR(link);
4305 if (IS_ERR(link)) 4303 if (IS_ERR(link))
4306 goto out; 4304 goto out;
4307 4305
@@ -4313,7 +4311,7 @@ int vfs_readlink(struct dentry *dentry, char __user *buffer, int buflen, const c
4313out: 4311out:
4314 return len; 4312 return len;
4315} 4313}
4316EXPORT_SYMBOL(vfs_readlink); 4314EXPORT_SYMBOL(readlink_copy);
4317 4315
4318/* 4316/*
4319 * A helper for ->readlink(). This should be used *ONLY* for symlinks that 4317 * A helper for ->readlink(). This should be used *ONLY* for symlinks that
@@ -4331,7 +4329,7 @@ int generic_readlink(struct dentry *dentry, char __user *buffer, int buflen)
4331 if (IS_ERR(cookie)) 4329 if (IS_ERR(cookie))
4332 return PTR_ERR(cookie); 4330 return PTR_ERR(cookie);
4333 4331
4334 res = vfs_readlink(dentry, buffer, buflen, nd_get_link(&nd)); 4332 res = readlink_copy(buffer, buflen, nd_get_link(&nd));
4335 if (dentry->d_inode->i_op->put_link) 4333 if (dentry->d_inode->i_op->put_link)
4336 dentry->d_inode->i_op->put_link(dentry, &nd, cookie); 4334 dentry->d_inode->i_op->put_link(dentry, &nd, cookie);
4337 return res; 4335 return res;
@@ -4356,8 +4354,7 @@ static char *page_getlink(struct dentry * dentry, struct page **ppage)
4356int page_readlink(struct dentry *dentry, char __user *buffer, int buflen) 4354int page_readlink(struct dentry *dentry, char __user *buffer, int buflen)
4357{ 4355{
4358 struct page *page = NULL; 4356 struct page *page = NULL;
4359 char *s = page_getlink(dentry, &page); 4357 int res = readlink_copy(buffer, buflen, page_getlink(dentry, &page));
4360 int res = vfs_readlink(dentry,buffer,buflen,s);
4361 if (page) { 4358 if (page) {
4362 kunmap(page); 4359 kunmap(page);
4363 page_cache_release(page); 4360 page_cache_release(page);