From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out30-110.freemail.mail.aliyun.com (out30-110.freemail.mail.aliyun.com [115.124.30.110]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 172AA37D137; Thu, 9 Apr 2026 14:21:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.110 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775744495; cv=none; b=dO849y8l0qGsq3CwBQBpynj6x9IKw+oQWw8uk2YsHIoXU63+DM/A2udmUGvyAfOdLAakgg9v0H+lbkVAJVaKPwW/0i11+KyCROa19AmyVKHSDMJ9CzreJzUuzts6RQYYWkw2akgD1ZPCO0Hq12uOo5HmUxCSHMzFrwkQUEzqICg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775744495; c=relaxed/simple; bh=TAhrCU1yS5iTWjB8mULVyAwL6hib3FysshaOPV+TjXg=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=QT0kFTTRQuiD/kI9gFnRBnPJTWW6S864I2dgS5OPuume0lSRveF3Fq5Ivknpl51h+kjZYXWzEfd29N0zT9gsEdepKHldvGXOKikICHHu/yQFSRNxMJ6ifXvoczUw/NVCjyeFug1qRm/4fzR7AcPQ1o/Z5Ad3l0/gaMHiq21kbSA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=v3Me7/Cn; arc=none smtp.client-ip=115.124.30.110 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="v3Me7/Cn" DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1775744487; h=Message-ID:Date:MIME-Version:Subject:To:From:Content-Type; bh=aTxGI8l0r04nOEb3UC/ArkCWhXNCZAZID+kdMOdexuI=; b=v3Me7/CnsaHbaESZs+UpPOi12DZ/YhqsaJWR58z5UHfZAT+UN8t5IZJfoPo8xgr/7AlfVbHkQWxbdwAE2uqFYATqUAHPfNyU9VZX73lb8hnuQMalzNtidCqH8QuNrFo2U+/Urw4qwR0pWSn7QxcTPLJmiCweX9LdPGJcMam7uEE= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R131e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033037033178;MF=hsiangkao@linux.alibaba.com;NM=1;PH=DS;RN=12;SR=0;TI=SMTPD_---0X0ibMHm_1775744485; Received: from 30.41.54.139(mailfrom:hsiangkao@linux.alibaba.com fp:SMTPD_---0X0ibMHm_1775744485 cluster:ay36) by smtp.aliyun-inc.com; Thu, 09 Apr 2026 22:21:26 +0800 Message-ID: Date: Thu, 9 Apr 2026 22:21:25 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] erofs: fix unsigned underflow in z_erofs_lz4_handle_overlap() To: Junrui Luo , linux-erofs@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, Yuhao Jiang , stable@vger.kernel.org, Gao Xiang , Chao Yu , Yue Hu , Jeffle Xu , Sandeep Dhavale , Hongbo Li , Chunhai Guo References: From: Gao Xiang In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2026/4/9 21:59, Junrui Luo wrote: > Some crafted images can have illegal (!partial_decoding && > m_llen < m_plen) extents, and the LZ4 inplace decompression path > can be wrongly hit, but it cannot handle (outpages < inpages) > properly: "outpages - inpages" wraps to a large value and > the subsequent rq->out[] access reads past the decompressed_pages > array. > > However, such crafted cases can correctly result in a corruption > report in the normal LZ4 non-inplace path. > > Let's add an additional check to fix this for backporting. > > Reproducible image (base64-encoded gzipped blob): > > H4sIAJGR12kCA+3SPUoDQRgG4MkmkkZk8QRbRFIIi9hbpEjrHQI5ghfwCN5BLCzTGtLbBI+g > dilSJo1CnIm7GEXFxhT6PDDwfrs73/ywIQD/1ePD4r7Ou6ETsrq4mu7XcWfj++Pb58nJU/9i > PNtbjhan04/9GtX4qVYc814WDqt6FaX5s+ZwXXeq52lndT6IuVvlblytLMvh4Gzwaf90nsvz > 2DF/21+20T/ldgp5s1jXRaN4t/8izsy/OUB6e/Qa79r+JwAAAAAAAL52vQVuGQAAAP6+my1w > ywAAAAAAAADwu14ATsEYtgBQAAA= > > $ mount -t erofs -o cache_strategy=disabled foo.erofs /mnt > $ dd if=/mnt/data of=/dev/null bs=4096 count=1 > > Fixes: 598162d05080 ("erofs: support decompress big pcluster for lz4 backend") > Reported-by: Yuhao Jiang > Cc: stable@vger.kernel.org > Signed-off-by: Junrui Luo Thanks for catching this: Reviewed-by: Gao Xiang Thanks, Gao Xiang