aboutsummaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorYunlei He <heyunlei@huawei.com>2015-11-28 14:38:40 +0800
committerMister Oyster <oysterized@gmail.com>2017-04-13 12:32:24 +0200
commit44e7baa2db6cba8e74c1128e7df099d12aa38fd2 (patch)
tree5743e539269c53ea6ca29be8037e581e7e2e5cb8 /fs
parentcaa909ac8ae902acf55f5352e2541008d945963f (diff)
downloadandroid_kernel_m2note-44e7baa2db6cba8e74c1128e7df099d12aa38fd2.tar.gz
f2fs: Fix a system panic caused by f2fs_follow_link
In linux 3.10, we can not make sure the return value of nd_get_link function is valid. So this patch add a check before use it. Signed-off-by: Yunlei He <heyunlei@huawei.com> Signed-off-by: Shuoran Liu <liushuoran@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/f2fs/namei.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
index 336d43d9c..bfaec10af 100644
--- a/fs/f2fs/namei.c
+++ b/fs/f2fs/namei.c
@@ -319,13 +319,18 @@ fail:
static void *f2fs_follow_link(struct dentry *dentry, struct nameidata *nd)
{
struct page *page;
+ char *link;
page = page_follow_link_light(dentry, nd);
if (IS_ERR(page))
return page;
+ link = nd_get_link(nd);
+ if (IS_ERR(link))
+ return link;
+
/* this is broken symlink case */
- if (*nd_get_link(nd) == 0) {
+ if (*link == 0) {
kunmap(page);
page_cache_release(page);
return ERR_PTR(-ENOENT);