Received: from out30-133.freemail.mail.aliyun.com (out30-133.freemail.mail.aliyun.com [115.124.30.133]) (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 7650A800 for ; Tue, 7 Jul 2026 13:22:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.133 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783430528; cv=none; b=Gt83KBUEqtBlvaYRN+v5MqBagPNL+j0Hw+j8bGrCH6yL4j7VKk7PfhpQRL2c4Xk8K3BRuA09dy5y8qDrwC+hHEeAyUVib/h2cD+9r7QSI8uW0lsfL4aFUM0bSFhQAUJpmYZR5WUWcb3mY8+nhdgElqfoGi+patO64buRiZ6UDlw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783430528; c=relaxed/simple; bh=bWUb/IetaQDwC29YKav+W81r39rahechtwKnJbW7yPg=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=nOKAQ6QTL1mjolSQX5Db38tCEHftLW+HdKzzUACG+EbuS2i3xTDoNBHz+aXE9hc+q5qVGoLIPwgsR8f5ZdTDzfRX9c9kL/tHaBWQkLiPvlGboWze/aVXnSGjQcatuuwoo3NHog4hiW41NN/J5lLZya9TCMu4NkBRzx3ajxRxm9w= 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=fvEv5cQc; arc=none smtp.client-ip=115.124.30.133 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="fvEv5cQc" DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1783430517; h=From:To:Subject:Date:Message-ID:MIME-Version; bh=a5hsotvxZtzR80XULwNX5K5SDey/8iDcL/FmljrpJ4s=; b=fvEv5cQc6IIiI7W1SVGoTw/grkfaSUg0OH91ptyMUiB2P95lKYyIspN4EiUaUf98GBSW+uiNr6iXdwoEVqOJ6ge7HSFfsLGCF5vjHnpQXXcldrrcuzqrgGT5EaxYC+dDVA5a2T7zffDJ1yQAWfoklIrIWbLdVi76Gs/WEadw43U= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R771e4;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=5;SR=0;TI=SMTPD_---0X6dnFPA_1783430512; Received: from x31i01179.sqa.na131.tbsite.net(mailfrom:hsiangkao@linux.alibaba.com fp:SMTPD_---0X6dnFPA_1783430512 cluster:ay36) by smtp.aliyun-inc.com; Tue, 07 Jul 2026 21:21:56 +0800 From: Gao Xiang To: linux-erofs@lists.ozlabs.org Cc: LKML , Gao Xiang , Yifan Zhao , Alberto Salvia Novella Subject: [PATCH] erofs: relax sanity check for tail pclusters on ztailpacking images Date: Tue, 7 Jul 2026 21:21:52 +0800 Message-ID: <20260707132152.1176967-1-hsiangkao@linux.alibaba.com> X-Mailer: git-send-email 2.43.5 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit If the tail data can be inlined into the inode meta block, it should be converted into a regular tail pcluster. In principle, it should be converted into an uncompressed pcluster if there is not enough gain to use compression (map->m_llen < map->m_plen); but since there are various shipped images, relax the condition for ztailpacking tail pclusters instead of reporting corruption incorrectly. Reported-by: Yifan Zhao Reported-by: Alberto Salvia Novella Closes: https://github.com/erofs/erofs-utils/issues/51 Fixes: a5242d37c83a ("erofs: error out obviously illegal extents in advance") Signed-off-by: Gao Xiang --- fs/erofs/zmap.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/erofs/zmap.c b/fs/erofs/zmap.c index bab521613552..f6b0172a6acc 100644 --- a/fs/erofs/zmap.c +++ b/fs/erofs/zmap.c @@ -732,7 +732,9 @@ static int z_erofs_map_sanity_check(struct inode *inode, map->m_algorithmformat, EROFS_I(inode)->nid); return -EFSCORRUPTED; } - if (EROFS_MAP_FULL(map->m_flags) && map->m_llen < map->m_plen) { + if (EROFS_MAP_FULL(map->m_flags) && map->m_llen < map->m_plen && + (map->m_la + map->m_llen < inode->i_size || + !erofs_sb_has_ztailpacking(sbi))) { erofs_err(inode->i_sb, "too much compressed data @ la %llu of nid %llu", map->m_la, EROFS_I(inode)->nid); return -EFSCORRUPTED; -- 2.43.5