Skip to content

Commit 7263b1b

Browse files
author
Jaegeuk Kim
committed
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: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
1 parent 5463e7c commit 7263b1b

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

fs/f2fs/namei.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -298,16 +298,14 @@ static int f2fs_unlink(struct inode *dir, struct dentry *dentry)
298298

299299
static void *f2fs_follow_link(struct dentry *dentry, struct nameidata *nd)
300300
{
301-
struct page *page;
301+
struct page *page = page_follow_link_light(dentry, nd);
302302

303-
page = page_follow_link_light(dentry, nd);
304-
if (IS_ERR(page))
303+
if (IS_ERR_OR_NULL(page))
305304
return page;
306305

307306
/* this is broken symlink case */
308307
if (*nd_get_link(nd) == 0) {
309-
kunmap(page);
310-
page_cache_release(page);
308+
page_put_link(dentry, nd, page);
311309
return ERR_PTR(-ENOENT);
312310
}
313311
return page;

0 commit comments

Comments
 (0)