Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp2091061ybp; Thu, 10 Oct 2019 02:02:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqyiYgUl3jrXUERoy+V6MvkuHXFwVvFkjl8STxcrTi1CIdyhBlc1hk91T0CZNv/Zkc5GYQyc X-Received: by 2002:aa7:c603:: with SMTP id h3mr7055080edq.44.1570698138662; Thu, 10 Oct 2019 02:02:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570698138; cv=none; d=google.com; s=arc-20160816; b=xzCwjm8KclVUW9gBz4/aiWDnboRc8ZiYKrpQzXmQwCiLo7O6pwhDof2IxO+TEL8xnE HlqvsMQ3vX7Ry6OEKtx9v9a2nXNPWs5MzYCG24MZg2DFb852SufeMQ6kyrVhVYPnoHTQ 3ChdZMDlp/WTS4qmgFH69bjXkjVD4UksldxAXh6heqD9wjCrf5LV5ML5q+aubbKieN+T yqOKsJZE0ejQC3R8YC5QfEL0AHkk0EiwDnEeLstghOjau8+r3yRPSwYx+0q8wVp81Vaw XDo6sVi7IR6zVz7Uvy89cFxX1Jf1cohlnPhRYHOZk8nMYAjTMxtOppI5E+w7Ve1qFchG ytew== 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=QnoaW+6TZ5LWWPlJecvzGC/vMUgFcOk3sFrv7G5cCko=; b=ahPv7zJPeNIQL7GqqmcUJVzy/MsaisiZ1RXXu+omxn5nyGIxgkJ4+/LS85r/uk8fHo AsLUH4C9xuIctIiOCG4djNYgrpB65+vWGdcQKdsAND1Iu4zw/WvcCvEWxTm6Gga/Xwzk vZQEQSVlE24pEXDfoHMQJPn41pMK1Mk+eA23CKUTSx5vVPOgwqUx8guJub3VbIzyG7V5 2zlssIfPN6YVKRop/M5z3RpBEOkc/Y5ouVUUyeDi8DbEWN/UAonpkGm/BA6a92+AwvHl GKw4XRNk4yatF2xmtMlHwmgTy0PzqwGVPnU02WT7S9P3jThRzZ11tkuJJx3GKiamuALL sieg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CwUreg+n; 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 d5si2712050edq.60.2019.10.10.02.01.55; Thu, 10 Oct 2019 02:02:18 -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=CwUreg+n; 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 S2388835AbfJJIn4 (ORCPT + 99 others); Thu, 10 Oct 2019 04:43:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:48874 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388809AbfJJInz (ORCPT ); Thu, 10 Oct 2019 04:43:55 -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 3A02F21929; Thu, 10 Oct 2019 08:43:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570697034; bh=oAxBDtac3cWfFjVWep7ONNKTlmqGnh7ooTDjepEn/WU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CwUreg+nEBY8TVpZgoCxxe+4LiIKanN5k9HCTwhSySD4vAwdQW2tsjpk5Li3GzE5C DdAfhz2BzxGBFc3MtbXwfl7TfsQ6DYP/kFfIfzbC2Fsm0dGd3nC1TjAGhpcbnqp2oU 3sZqMzPAPgzjBA/9N7UeVqvLp2cUffADZ06WrM6I= 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 144/148] staging: erofs: some compressed cluster should be submitted for corrupted images Date: Thu, 10 Oct 2019 10:36:45 +0200 Message-Id: <20191010083621.018382009@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 ee45197c807895e156b2be0abcaebdfc116487c8 upstream. As reported by erofs_utils fuzzer, a logical page can belong to at most 2 compressed clusters, if one compressed cluster is corrupted, but the other has been ready in submitting chain. The chain needs to submit anyway in order to keep the page working properly (page unlocked with PG_error set, PG_uptodate not set). Let's fix it now. 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-2-gaoxiang25@huawei.com [ Gao Xiang: Manually backport to v5.3.y stable. ] Signed-off-by: Gao Xiang Signed-off-by: Greg Kroah-Hartman --- drivers/staging/erofs/unzip_vle.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) --- a/drivers/staging/erofs/unzip_vle.c +++ b/drivers/staging/erofs/unzip_vle.c @@ -1498,19 +1498,18 @@ static int z_erofs_vle_normalaccess_read err = z_erofs_do_read_page(&f, page, &pagepool); (void)z_erofs_vle_work_iter_end(&f.builder); - if (err) { + /* if some compressed cluster ready, need submit them anyway */ + z_erofs_submit_and_unzip(&f, &pagepool, true); + + if (err) errln("%s, failed to read, err [%d]", __func__, err); - goto out; - } - z_erofs_submit_and_unzip(&f, &pagepool, true); -out: if (f.map.mpage) put_page(f.map.mpage); /* clean up the remaining free pages */ put_pages_list(&pagepool); - return 0; + return err; } static int z_erofs_vle_normalaccess_readpages(struct file *filp,