Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 07B19C433B4 for ; Mon, 17 May 2021 10:34:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D1DB6611ED for ; Mon, 17 May 2021 10:34:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234691AbhEQKf1 (ORCPT ); Mon, 17 May 2021 06:35:27 -0400 Received: from wout4-smtp.messagingengine.com ([64.147.123.20]:46327 "EHLO wout4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231754AbhEQKf0 (ORCPT ); Mon, 17 May 2021 06:35:26 -0400 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id 4C003AED; Mon, 17 May 2021 06:34:09 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Mon, 17 May 2021 06:34:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kroah.com; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm3; bh=RsDU+xE10Nbh1FFYxZYGSDPWg/3 7OHjVLBDs3JnjJAA=; b=pa6FTxhFhYScoLPFsc5KV5+VRGifSZzE6xiuuOaun1w xkUjjxdTw3cNAaBxU5n0x3mAy+giBWIXiKmjPcWzIrtwE/ix3Q/sOsN7hB5bK6Gv B5dio1D3RSrhvRd/YVXbuas1BK1tqYbNyoMcKzus0Vw+ae88R1uG0nula2yI4kdB uvgk5vQR2h88pK3qI9AJVGXCU5zlAnfksCLjdiBeqV/2GU9VBvq0HZwGDUnKyDtk t3+RSKxZedoEBunUDib7IGPYxjMyrgzTHEfQZBh5QdHCSF1L6oStkVKnaCeDMR5o R3Vjc6uuEhYhb6GVieWbUTkxxPDXTm+XziUhHRzOGWA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=RsDU+x E10Nbh1FFYxZYGSDPWg/37OHjVLBDs3JnjJAA=; b=q6O7GAKZ0CH2gYlHa00thV p/u5r1+yN1u0zC5ud2GouNg2A0fj7cTa1Fs2FrumA17P3CNYDojtUurIFIhOGnw0 73Jud7xlHkEYO+HF2usr2Wl8l39v6qM4df6y/yLg5YxkOBjyjVpXOn01E/NiplP/ d/ADp0GJ1ox2yskY7cD2OE/oBdQrcba3/E3q/Z+UJkMO2nTVxsKgZIH4fKtUGFA4 Ui2dovDBSslZLRgxE6zesZ3gqLWn86jxcnHNxj7InUNm2SbNt3FNBX22DbYNnXV8 z8x+7lgFkZ+uRUJNvFCx13dtQs9uktpr2G2YXY/4uRaCpsyduSKVzOzpn0xcCX7w == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvdeihedgfeduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfhfgggtuggjsehttdortddttddvnecuhfhrohhmpefirhgvghcu mffjuceoghhrvghgsehkrhhorghhrdgtohhmqeenucggtffrrghtthgvrhhnpeevhefgje eitdfffefhvdegleeigeejgeeiffekieffjeeflefhieegtefhudejueenucfkphepkeef rdekiedrjeegrdeigeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrih hlfhhrohhmpehgrhgvgheskhhrohgrhhdrtghomh X-ME-Proxy: Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 17 May 2021 06:34:07 -0400 (EDT) Date: Mon, 17 May 2021 12:34:06 +0200 From: Greg KH To: Eric Biggers Cc: stable@vger.kernel.org, Yunlei He , Chao Yu , Jaegeuk Kim Subject: Re: [PATCH 5.4] f2fs: fix error handling in f2fs_end_enable_verity() Message-ID: References: <20210512194714.1199896-1-ebiggers@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210512194714.1199896-1-ebiggers@kernel.org> Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org On Wed, May 12, 2021 at 12:47:14PM -0700, Eric Biggers wrote: > From: Eric Biggers > > commit 3c0315424f5e3d2a4113c7272367bee1e8e6a174 upstream. > > f2fs didn't properly clean up if verity failed to be enabled on a file: > > - It left verity metadata (pages past EOF) in the page cache, which > would be exposed to userspace if the file was later extended. > > - It didn't truncate the verity metadata at all (either from cache or > from disk) if an error occurred while setting the verity bit. > > Fix these bugs by adding a call to truncate_inode_pages() and ensuring > that we truncate the verity metadata (both from cache and from disk) in > all error paths. Also rework the code to cleanly separate the success > path from the error paths, which makes it much easier to understand. > > Finally, log a message if f2fs_truncate() fails, since it might > otherwise fail silently. > > Reported-by: Yunlei He > Fixes: 95ae251fe828 ("f2fs: add fs-verity support") > Cc: # v5.4+ > Signed-off-by: Eric Biggers > Reviewed-by: Chao Yu > Signed-off-by: Jaegeuk Kim > --- > fs/f2fs/verity.c | 75 ++++++++++++++++++++++++++++++++++-------------- > 1 file changed, 54 insertions(+), 21 deletions(-) Now queued up, thanks. greg k-h