Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp606126pxb; Tue, 5 Apr 2022 15:44:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz/euSCKKpUze4skSnnY881bf8G8qFBu8S8xxOZpjUnxF55DirXysNNVue4KmxrgPBUMrrk X-Received: by 2002:a05:6a00:130e:b0:4f3:9654:266d with SMTP id j14-20020a056a00130e00b004f39654266dmr5706788pfu.59.1649198687689; Tue, 05 Apr 2022 15:44:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649198687; cv=none; d=google.com; s=arc-20160816; b=k2FeBuvOPNdb6PW8fC8hHWmXwVDDlpm++FyyTrcCTRmuSShOkU9vYveg0nGg8ze5Mu Q0rXDnLnIxFsRx84ve2hxCen1/9MAU3lghQhnslBdzr8MEckEJNJc458SzYbEezcdpYh JbLSwbNEAJLXd/4+if9qvM2nenQ4zfJcXl0VIx6QxQCVKDL9MClffIoBIncL2S5IHT8D TrisOZ6zDNwoCvM9cM2jXpI9OwiWQ6myRFELwM7jH1u0FPEqzBuSlqnRdkXSboqZDkxV Y5ZsLaxr1tVTkGLXmNHK4OOOtUNUSL0k6KXBSGDUm18FCjp5PVLm5zq4iFOz0yLuk+2j dHnA== 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=vVJTV1Ol8n8xSB0GAXI2/winsmGI2wj+0L+EL4zlBGg=; b=F1q0vN7f50wf3X4kV44vs4shwy3QYYhoBw7NlZbog/0rhgk3XEPCrC9MC8O8fnEoNi 91vEIXmbvSwrcmzLG0OU3IAJ8VU3PQ8wjVNCazBia5HX67CDflEc7Yt8PaI0MmV/gdba XC4XzKnwC+E38Usz6qEOhRnUm5S1cdU/BUdBDiz/BJVB/U9QVXv+WFgceSxg3MBGhBRz 1Lz3yM902mpc3M0jCriJ0gAENGpOxpmJmRmLuOekgcUGUOV+PDQjsfe6YeXmlQosz+nx Yz0aOLOcxdsuPXHvAcSEituBHRW+t0PVrlnhioB4zCDftiFOgtSzx8vJFCRZD4Dj/Knl hMOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rR2vOWus; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id 22-20020a630e56000000b003821cf2feafsi14053650pgo.421.2022.04.05.15.44.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Apr 2022 15:44:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rR2vOWus; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id DD3BE6E4F4; Tue, 5 Apr 2022 15:25:06 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1389812AbiDENeS (ORCPT + 99 others); Tue, 5 Apr 2022 09:34:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346785AbiDEJYm (ORCPT ); Tue, 5 Apr 2022 05:24:42 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73E6C939C9; Tue, 5 Apr 2022 02:14:04 -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 ams.source.kernel.org (Postfix) with ESMTPS id A0B4FB81C6A; Tue, 5 Apr 2022 09:13:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EED13C385A0; Tue, 5 Apr 2022 09:13:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649150033; bh=Sa1kMv1sdCnfZFoBz5fJjwVY0FENvkmbuFF3lGAys4I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rR2vOWusEU25Dawl6iF844zOiJr37U8Ic8m9IB+JscoSKqxkdh+LKa5vbUl7G3/gj 8j75GjOPBFzPT7b/SzSV99SC5f1iRC7ier/U0oXc7bhAWcy9fM7JthqLn61XtP9BDE UrmPZ5kFJL6+oC5EelRz8eVAekh3K7/3Q5WxtKYQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andreas Gruenbacher Subject: [PATCH 5.16 0931/1017] gfs2: Fix gfs2_file_buffered_write endless loop workaround Date: Tue, 5 Apr 2022 09:30:44 +0200 Message-Id: <20220405070421.850675722@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070354.155796697@linuxfoundation.org> References: <20220405070354.155796697@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=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 commit 46f3e0421ccb5474b5c006b0089b9dfd42534bb6 upstream. Since commit 554c577cee95b, gfs2_file_buffered_write() can accidentally return a truncated iov_iter, which might confuse callers. Fix that. Fixes: 554c577cee95b ("gfs2: Prevent endless loops in gfs2_file_buffered_write") Signed-off-by: Andreas Gruenbacher Signed-off-by: Greg Kroah-Hartman --- fs/gfs2/file.c | 1 + 1 file changed, 1 insertion(+) --- a/fs/gfs2/file.c +++ b/fs/gfs2/file.c @@ -1083,6 +1083,7 @@ out_uninit: gfs2_holder_uninit(gh); if (statfs_gh) kfree(statfs_gh); + from->count = orig_count - read; return read ? read : ret; }