Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9813cae6 authored by Qiuyang Sun's avatar Qiuyang Sun Committed by Jaegeuk Kim
Browse files

f2fs: release locks before return in f2fs_ioc_gc_range()



Currently, we will leave the kernel with locks still held when the gc_range
is invalid. This patch fixes the bug.

Signed-off-by: default avatarQiuyang Sun <sunqiuyang@huawei.com>
Reviewed-by: default avatarChao Yu <yuchao0@huawei.com>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent cee6482c
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -2058,8 +2058,10 @@ static int f2fs_ioc_gc_range(struct file *filp, unsigned long arg)
		return ret;

	end = range.start + range.len;
	if (range.start < MAIN_BLKADDR(sbi) || end >= MAX_BLKADDR(sbi))
		return -EINVAL;
	if (range.start < MAIN_BLKADDR(sbi) || end >= MAX_BLKADDR(sbi)) {
		ret = -EINVAL;
		goto out;
	}
do_more:
	if (!range.sync) {
		if (!mutex_trylock(&sbi->gc_mutex)) {