From: Jaegeuk Kim Date: Wed, 22 Apr 2015 18:03:48 +0000 (-0700) Subject: f2fs: fix wrong error hanlder in f2fs_follow_link X-Git-Tag: MMI-PSA29.97-13-9~10117^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=7263b1bd0490fca68ee7eedb0b6973cb86d4701c;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git 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 Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim --- diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c index 7e3794edae42..658e8079aaf9 100644 --- a/fs/f2fs/namei.c +++ b/fs/f2fs/namei.c @@ -298,16 +298,14 @@ fail: 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(page)) + if (IS_ERR_OR_NULL(page)) return page; /* this is broken symlink case */ if (*nd_get_link(nd) == 0) { - kunmap(page); - page_cache_release(page); + page_put_link(dentry, nd, page); return ERR_PTR(-ENOENT); } return page;