Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+3 -5
+3 -5
fs/f2fs/namei.c
··· 298 298 299 299 static void *f2fs_follow_link(struct dentry *dentry, struct nameidata *nd) 300 300 { 301 - struct page *page; 301 + struct page *page = page_follow_link_light(dentry, nd); 302 302 303 - page = page_follow_link_light(dentry, nd); 304 - if (IS_ERR(page)) 303 + if (IS_ERR_OR_NULL(page)) 305 304 return page; 306 305 307 306 /* this is broken symlink case */ 308 307 if (*nd_get_link(nd) == 0) { 309 - kunmap(page); 310 - page_cache_release(page); 308 + page_put_link(dentry, nd, page); 311 309 return ERR_PTR(-ENOENT); 312 310 } 313 311 return page;