Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp442434iog; Mon, 13 Jun 2022 06:05:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwzI2KxEDRt8qstPex6lJ7U0I0RDm730N8qUMG8u6iO11fo+tuIAxeYzgrc6LMCOPEJ2zG8 X-Received: by 2002:a05:6402:32a6:b0:42d:ed8b:3d8 with SMTP id f38-20020a05640232a600b0042ded8b03d8mr64662582eda.225.1655125440796; Mon, 13 Jun 2022 06:04:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655125440; cv=none; d=google.com; s=arc-20160816; b=aKwnfdFx4fauqgowt3Pc9t+Y8fsIxniOk6XwMywzslX5Fw2zPIDPzVMYBvkHVHmIs0 UtNhsJkU4F3nS2mqX/RhF6wVDcwpaLtsE6al9HPtxAHVTpcdeC4S+aJc6Gilaw/Y5t0A 92T7q3uEKM5gQDSA5X+clWMstz4AcjZJRvHoNvzMZEAae7edrg+uSqPgqs/6QOMy+zaa 3Tt9Ak1D0nYrtE8Olq3xL/Ka6rGENNyYMYasueeUiwjeDkyIcBWlT5QHbIgZxvI33noq KwHIyv3m7L30NEqxRkfAbw4n1krkK1bva184ubT6/o/qzOZCL+uR7jY9wH3AUeDQe5ma TvWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=3OgjwW2ZMHauMeIHHQqX6J7lYkyvy8cmojSzJcajy70=; b=A0yJy5EBNLJbe+vZIlFFUoql/GDpNy3V3cu0Ps5W/Dqit2IPDevqXWjhveepfkLMj6 yUl+VagfMlfOPp1VgIETxRlhvPSS9iIobodXxuo6HGyvhax6K07iIPrTuHkaZK68FanJ KaKX2EjZK7qikCVLG91IG3GsXeUpFcKm3pOp+SFwzGdc6iXATuoA/tGEy9J66xabGvmx IDRtnijCmTXjO3/2DMau+1KEgmqUx+9GDc2hiLvqUnl0FOIZfd1gZn8sPt8/bLUx24E5 9u2rFJM88ib+epLIfUZUJ+YEDyszzMbVbDZyfuAGnt/hCbxDD1xYS9PYfY+mZvpl1WiE /ZNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gxrEoKg6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m3-20020a056402430300b00430328fe4a1si9557663edc.402.2022.06.13.06.03.34; Mon, 13 Jun 2022 06:04:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gxrEoKg6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353335AbiFMLTk (ORCPT + 99 others); Mon, 13 Jun 2022 07:19:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353184AbiFMLPL (ORCPT ); Mon, 13 Jun 2022 07:15:11 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE1021706C; Mon, 13 Jun 2022 03:37:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 67C82610A0; Mon, 13 Jun 2022 10:37:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 74790C34114; Mon, 13 Jun 2022 10:37:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655116663; bh=ZxbUcwez3WdEnE9tY/sNxfsE6rTp4gQ6TFB5pkMV2RI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gxrEoKg6Nv78L/lLL3vrYe/mSTsz5dCkvRu//X18lEmRKv7chzcqNnA68G00SwjIe TfScTzNH7fk5uKGtkom+sE2cxF26qs8rN+I8PsCS4t+ariMnAnMlODHyNR86rc+MUh PZ5BEeEj4BPMCDI570sa8aWn3u2odVHt/0ofzU3o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andreas Gruenbacher , "Darrick J. Wong" , Sasha Levin Subject: [PATCH 5.4 128/411] iomap: iomap_write_failed fix Date: Mon, 13 Jun 2022 12:06:41 +0200 Message-Id: <20220613094932.510827363@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220613094928.482772422@linuxfoundation.org> References: <20220613094928.482772422@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andreas Gruenbacher [ Upstream commit b71450e2cc4b3c79f33c5bd276d152af9bd54f79 ] The @lend parameter of truncate_pagecache_range() should be the offset of the last byte of the hole, not the first byte beyond it. Fixes: ae259a9c8593 ("fs: introduce iomap infrastructure") Signed-off-by: Andreas Gruenbacher Reviewed-by: Darrick J. Wong Signed-off-by: Darrick J. Wong Signed-off-by: Sasha Levin --- fs/iomap/buffered-io.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c index 5c73751adb2d..53cd7b2bb580 100644 --- a/fs/iomap/buffered-io.c +++ b/fs/iomap/buffered-io.c @@ -535,7 +535,8 @@ iomap_write_failed(struct inode *inode, loff_t pos, unsigned len) * write started inside the existing inode size. */ if (pos + len > i_size) - truncate_pagecache_range(inode, max(pos, i_size), pos + len); + truncate_pagecache_range(inode, max(pos, i_size), + pos + len - 1); } static int -- 2.35.1