Skip to content

Commit

Permalink
staging: erofs: add two missing erofs_workgroup_put for corrupted images
Browse files Browse the repository at this point in the history
commit 138e1a0 upstream.

As reported by erofs-utils fuzzer, these error handling
path will be entered to handle corrupted images.

Lack of erofs_workgroup_puts will cause unmounting
unsuccessfully.

Fix these return values to EFSCORRUPTED as well.

Fixes: 3883a79 ("staging: erofs: introduce VLE decompression support")
Cc: <stable@vger.kernel.org> # 4.19+
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Link: https://lore.kernel.org/r/20190819103426.87579-4-gaoxiang25@huawei.com
[ Gao Xiang: Older kernel versions don't have length validity check
             and EFSCORRUPTED, thus backport pageofs check for now. ]
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Gao Xiang authored and Greg Kroah-Hartman committed Oct 11, 2019
1 parent f59a603 commit 5bb124e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/staging/erofs/unzip_vle.c
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,11 @@ z_erofs_vle_work_lookup(const struct z_erofs_vle_work_finder *f)
/* if multiref is disabled, `primary' is always true */
primary = true;

DBG_BUGON(work->pageofs != f->pageofs);
if (work->pageofs != f->pageofs) {
DBG_BUGON(1);
erofs_workgroup_put(egrp);
return ERR_PTR(-EIO);
}

/*
* lock must be taken first to avoid grp->next == NIL between
Expand Down

0 comments on commit 5bb124e

Please sign in to comment.