mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
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>
This commit is contained in:
parent
9a7dcc468f
commit
3bdb893816
1 changed files with 6 additions and 1 deletions
|
@ -318,13 +318,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);
|
||||
|
|
Loading…
Reference in a new issue