Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp2076209ybp; Thu, 10 Oct 2019 01:45:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqz6VtHHJU/bevxQTEi9dxnaTP8ITvTj0NAyLUPKgc/8Y1utas9FIs+JIsry23rHO1H28x0Q X-Received: by 2002:aa7:df95:: with SMTP id b21mr6896053edy.16.1570697132234; Thu, 10 Oct 2019 01:45:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570697132; cv=none; d=google.com; s=arc-20160816; b=uGcXw87IPOba9LBwUSQtm+kETYcKoAgd1SKn9GFRQj6p8lUGUbSqBP1Sqe0TKY+zWj 2X5Qf8KgJIEfVWKhZPMOheuELcbYFN8aCyOIcQyb9kSal1RTosPNrAsyBF472MtLp2EN ywvzzGZBcJcPWO0xcUASMKIburdSfvoiu7scvHfijr3gDCMPdNBYKWK6REz16fgwb0hR B8mpoMl9yo5DeWBrNVi3dLOQV1HpkBHT/vHLjtDUOWijabObBBjSEgdVl6TjhqTXUQeL xL0xYcklaNOOYRsRaR7955oXXRUAy4t0bMrdLcGlzUYk7Dh33jJBgOiF5nEDYwAvgScK 0klA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=l+eQmDNHYhkAopHSTanCw7SAYrQQp32cZkOP8o0qFEA=; b=rPhHyNL37Owpe0ZwiB+DubxEfXeyralBar88ELxUdJMlZzZ+ly0hkrRYnef4mveWKM CGEx7bcIYyHlM2NznhaA8WVEDsWR8OieNGKhVgE3AHYPIy8jL1qbBwE2EUTyOe22WF/v tuGrVU2ctC/+U8kGWBwY/x3n/CqDAnxac0DTzvOVYTjz1YLojW47K7i6I1ZRYKlfoCma h/NpWYLordz5F4H04xusmHSpLodeymtPWnNO7Vn360TBF/fpWo2T+jOiJ4pVC44YW8l/ fAV6YvvWm+UW2P5AwOsCOTCcez/+/sYm3PX9ddb0R6UndzpRbqWRhz+B57VkRmd0lUVC ML3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=t5EAKk90; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id np3si2733699ejb.384.2019.10.10.01.45.09; Thu, 10 Oct 2019 01:45:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=t5EAKk90; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388847AbfJJIn7 (ORCPT + 99 others); Thu, 10 Oct 2019 04:43:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:48934 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388809AbfJJIn6 (ORCPT ); Thu, 10 Oct 2019 04:43:58 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DD6DB21A4A; Thu, 10 Oct 2019 08:43:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570697037; bh=wWycjSe87ABTArlAOL+ByNftzpQs1CTCAGwPbq6zjpw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t5EAKk90js6e4OdjR1ZNh/ySa6lkP8Fjdcz4StJBH4Tig3PJ6N2iXAM82LW3RuRn3 Kj91BeTIks52P5UONG9whGYqAASnI2pj0JJ2G5QOUSucGuZoZamlbklFwd2uATPV/i n5P2SdkDG2QNswbHfJ2un+HXRUZjWKnEscmHgeVs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Gao Xiang , Chao Yu Subject: [PATCH 5.3 145/148] staging: erofs: add two missing erofs_workgroup_put for corrupted images Date: Thu, 10 Oct 2019 10:36:46 +0200 Message-Id: <20191010083621.070554441@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191010083609.660878383@linuxfoundation.org> References: <20191010083609.660878383@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Gao Xiang commit 138e1a0990e80db486ab9f6c06bd5c01f9a97999 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: 3883a79abd02 ("staging: erofs: introduce VLE decompression support") Cc: # 4.19+ Signed-off-by: Gao Xiang Reviewed-by: Chao Yu 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 Signed-off-by: Greg Kroah-Hartman --- drivers/staging/erofs/unzip_vle.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) --- a/drivers/staging/erofs/unzip_vle.c +++ b/drivers/staging/erofs/unzip_vle.c @@ -393,7 +393,11 @@ z_erofs_vle_work_lookup(const struct z_e /* 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