From: Qiuyang Sun Date: Tue, 13 Mar 2018 11:42:50 +0000 (+0800) Subject: f2fs: release locks before return in f2fs_ioc_gc_range() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=9813cae680f06967c8b79467d93a20086bcd7ef4;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git 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: Qiuyang Sun Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim --- diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 5783584cfbe5..13fee9252e1b 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -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)) {