diff options
-rw-r--r-- | fs/namei.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/fs/namei.c b/fs/namei.c index ee1544696e83..01e67dddcc3d 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -2856,16 +2856,17 @@ int generic_readlink(struct dentry *dentry, char __user *buffer, int buflen) | |||
2856 | { | 2856 | { |
2857 | struct nameidata nd; | 2857 | struct nameidata nd; |
2858 | void *cookie; | 2858 | void *cookie; |
2859 | int res; | ||
2859 | 2860 | ||
2860 | nd.depth = 0; | 2861 | nd.depth = 0; |
2861 | cookie = dentry->d_inode->i_op->follow_link(dentry, &nd); | 2862 | cookie = dentry->d_inode->i_op->follow_link(dentry, &nd); |
2862 | if (!IS_ERR(cookie)) { | 2863 | if (IS_ERR(cookie)) |
2863 | int res = vfs_readlink(dentry, buffer, buflen, nd_get_link(&nd)); | 2864 | return PTR_ERR(cookie); |
2864 | if (dentry->d_inode->i_op->put_link) | 2865 | |
2865 | dentry->d_inode->i_op->put_link(dentry, &nd, cookie); | 2866 | res = vfs_readlink(dentry, buffer, buflen, nd_get_link(&nd)); |
2866 | cookie = ERR_PTR(res); | 2867 | if (dentry->d_inode->i_op->put_link) |
2867 | } | 2868 | dentry->d_inode->i_op->put_link(dentry, &nd, cookie); |
2868 | return PTR_ERR(cookie); | 2869 | return res; |
2869 | } | 2870 | } |
2870 | 2871 | ||
2871 | int vfs_follow_link(struct nameidata *nd, const char *link) | 2872 | int vfs_follow_link(struct nameidata *nd, const char *link) |