Commit 7263b1bd authored by Jaegeuk Kim's avatar Jaegeuk Kim

f2fs: fix wrong error hanlder in f2fs_follow_link

The page_follow_link_light returns NULL and its error pointer was remained
in nd->path.
Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: default avatarChao Yu <chao2.yu@samsung.com>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent 5463e7c1
...@@ -298,16 +298,14 @@ static int f2fs_unlink(struct inode *dir, struct dentry *dentry) ...@@ -298,16 +298,14 @@ static int f2fs_unlink(struct inode *dir, struct dentry *dentry)
static void *f2fs_follow_link(struct dentry *dentry, struct nameidata *nd) static void *f2fs_follow_link(struct dentry *dentry, struct nameidata *nd)
{ {
struct page *page; struct page *page = page_follow_link_light(dentry, nd);
page = page_follow_link_light(dentry, nd); if (IS_ERR_OR_NULL(page))
if (IS_ERR(page))
return page; return page;
/* this is broken symlink case */ /* this is broken symlink case */
if (*nd_get_link(nd) == 0) { if (*nd_get_link(nd) == 0) {
kunmap(page); page_put_link(dentry, nd, page);
page_cache_release(page);
return ERR_PTR(-ENOENT); return ERR_PTR(-ENOENT);
} }
return page; return page;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment