From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B1DBBC83F3F for ; Mon, 4 Sep 2023 18:32:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237384AbjIDSc5 (ORCPT ); Mon, 4 Sep 2023 14:32:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240120AbjIDSc5 (ORCPT ); Mon, 4 Sep 2023 14:32:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D309B2 for ; Mon, 4 Sep 2023 11:32:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D020B61989 for ; Mon, 4 Sep 2023 18:32:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E55A7C433C8; Mon, 4 Sep 2023 18:32:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1693852373; bh=rjikq4wDQ55f+RTG/gClM25jalKnthsg+WKHQ00cOXQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fathZn10jS41dTaDo20cMzf+QaOWrCTklh5xI8muhj2QOyhPdLgfIU36toPbpJV7O FjrCukdFsuUO4EFYC02fK+q4Sf+InBAwakiuiT//uMNL2sgg067WTIUn7NnrHTVKdn HVDM84WXn5tUmO1wGfQwFmLYg0bHeKLHNzzc/nck= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, keltargw , Gao Xiang Subject: [PATCH 6.4 01/32] erofs: ensure that the post-EOF tails are all zeroed Date: Mon, 4 Sep 2023 19:29:59 +0100 Message-ID: <20230904182947.968480005@linuxfoundation.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230904182947.899158313@linuxfoundation.org> References: <20230904182947.899158313@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 6.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Gao Xiang commit e4c1cf523d820730a86cae2c6d55924833b6f7ac upstream. This was accidentally fixed up in commit e4c1cf523d82 but we can't take the full change due to other dependancy issues, so here is just the actual bugfix that is needed. [Background] keltargw reported an issue [1] that with mmaped I/Os, sometimes the tail of the last page (after file ends) is not filled with zeroes. The root cause is that such tail page could be wrongly selected for inplace I/Os so the zeroed part will then be filled with compressed data instead of zeroes. A simple fix is to avoid doing inplace I/Os for such tail parts, actually that was already fixed upstream in commit e4c1cf523d82 ("erofs: tidy up z_erofs_do_read_page()") by accident. [1] https://lore.kernel.org/r/3ad8b469-25db-a297-21f9-75db2d6ad224@linux.alibaba.com Reported-by: keltargw Fixes: 3883a79abd02 ("staging: erofs: introduce VLE decompression support") Signed-off-by: Gao Xiang Signed-off-by: Greg Kroah-Hartman --- fs/erofs/zdata.c | 2 ++ 1 file changed, 2 insertions(+) --- a/fs/erofs/zdata.c +++ b/fs/erofs/zdata.c @@ -993,6 +993,8 @@ hitted: cur = end - min_t(erofs_off_t, offset + end - map->m_la, end); if (!(map->m_flags & EROFS_MAP_MAPPED)) { zero_user_segment(page, cur, end); + ++spiltted; + tight = false; goto next_part; } if (map->m_flags & EROFS_MAP_FRAGMENT) {