Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp3229600ybf; Tue, 3 Mar 2020 02:01:02 -0800 (PST) X-Google-Smtp-Source: ADFU+vuvaPZT+avVHnWCTywGHNi3KkJEuXmpDS4PI5hODyg02IUtqWaErV9hzK44cwXkV2FENsrg X-Received: by 2002:a54:4801:: with SMTP id j1mr1969604oij.108.1583229661850; Tue, 03 Mar 2020 02:01:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583229661; cv=none; d=google.com; s=arc-20160816; b=JAhZ4PUuKvRlzzFWVrVGp5Dejp5yx9b5TltSI+9k6tjGrppOztL8fEgRmviNjFJ1kY yl9biTgDOduMRc8iSaueLclnXdKaHBVpiosqtyuiW7Ug8g6u+m188wLCva7Ad5WhcbZI XmpQiRaC1mxVQLL7NiZ2kT/q50loV5+5bw5BuvXLPp+K+VpuUx9iPCGsBT3sXeydhiyy NXh+CF0XjEjjOsD24nK0iLiZlAo9A2Qll+EwYtieWxVUZEknyo3XC4cSEFcfkzg1/Qgo Wqx2CtCr/e6fw+bxq3UZ5JI73Anls0tCrMB5uGWMH6obajtpVC8OFKMLTN/TWPZgC5us yJHw== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=g1Xq/IZNGop/VBD1g5ddW3w/fm0A6j0YxcoQmTKmU7o=; b=iFYv7LnXnK+FeWPnK+jjqKZMH+wLH2maixUfxXEcRi7DovWHkipzyv/D3v/Zm0W8Us 4DlyiCGJZJ9rFIQsbCtLspXp6SokMbxderIhroTHswrSn2ZAi+zpJ94M3hrobPTd+gZz ugYFyYYZIW7MiKmXNg4whpQN+6vioeAySEj1kWgOGW8DG/dBecmj59wMPTiB+1iuW0XD sKDDnWdq7Pl1fv6qzvoqm/kzfSp4x9aKyI6krS2SggFEBE2IbDn5H2KohPOQO9/+ITRS hlQFBg2YNmHXDX6QIiYe+zia3eifWmpMa6JKgv3dop/VVT/0rMsLjGhdJnVGTmucC2v5 cDAA== ARC-Authentication-Results: i=1; mx.google.com; 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 s15si3306468otr.16.2020.03.03.02.00.48; Tue, 03 Mar 2020 02:01:01 -0800 (PST) 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; 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 S1727998AbgCCJvc (ORCPT + 99 others); Tue, 3 Mar 2020 04:51:32 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:44506 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725879AbgCCJvb (ORCPT ); Tue, 3 Mar 2020 04:51:31 -0500 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 11EC5620F1442FAA58A8; Tue, 3 Mar 2020 17:51:29 +0800 (CST) Received: from [10.134.22.195] (10.134.22.195) by smtp.huawei.com (10.3.19.214) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 3 Mar 2020 17:51:19 +0800 Subject: Re: [PATCH 3/3] erofs: handle corrupted images whose decompressed size less than it'd be To: Gao Xiang , CC: LKML , Miao Xie , "Lasse Collin" References: <20200226023011.103798-1-gaoxiang25@huawei.com> <20200226023011.103798-3-gaoxiang25@huawei.com> From: Chao Yu Message-ID: <83e017a2-f94b-7dea-7ffd-301303b18397@huawei.com> Date: Tue, 3 Mar 2020 17:51:19 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20200226023011.103798-3-gaoxiang25@huawei.com> Content-Type: text/plain; charset="windows-1252" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.134.22.195] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020/2/26 10:30, Gao Xiang wrote: > As Lasse pointed out, "Looking at fs/erofs/decompress.c, > the return value from LZ4_decompress_safe_partial is only > checked for negative value to catch errors. ... So if > I understood it correctly, if there is bad data whose > uncompressed size is much less than it should be, it can > leave part of the output buffer untouched and expose the > previous data as the file content. " > > Let's fix it now. > > Cc: Lasse Collin > Signed-off-by: Gao Xiang Reviewed-by: Chao Yu Thanks,