diff options
| author | Yunlei He <heyunlei@huawei.com> | 2015-11-28 14:38:40 +0800 |
|---|---|---|
| committer | Mister Oyster <oysterized@gmail.com> | 2017-04-13 12:32:24 +0200 |
| commit | 44e7baa2db6cba8e74c1128e7df099d12aa38fd2 (patch) | |
| tree | 5743e539269c53ea6ca29be8037e581e7e2e5cb8 /fs | |
| parent | caa909ac8ae902acf55f5352e2541008d945963f (diff) | |
| download | android_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.c | 7 |
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); |
