From patchwork Tue Apr 5 07:29:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 557802 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 5E653C38162 for ; Tue, 5 Apr 2022 08:56:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245591AbiDEI4Z (ORCPT ); Tue, 5 Apr 2022 04:56:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241060AbiDEIcq (ORCPT ); Tue, 5 Apr 2022 04:32:46 -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 9BF60B820A; Tue, 5 Apr 2022 01:26:20 -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 3C26A60FFC; Tue, 5 Apr 2022 08:26:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4B527C385A4; Tue, 5 Apr 2022 08:26:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649147179; bh=Sa1kMv1sdCnfZFoBz5fJjwVY0FENvkmbuFF3lGAys4I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jvoJA7wKO/A/lVy8R0d0OtRBeGVgef/NAuwt/TooroqU/XJvRXdCt9cTv5C93r8ge moc4ItCq+zDePZDTY/LC5qtE/YWaG0hRYeT/aHNotkqZZJ+dmpucqEWz5BEyaWK6Hh ftlA6rX0JQmI/oV9TiEPjlL9rzDRH72kJZvGzoR8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andreas Gruenbacher Subject: [PATCH 5.17 1030/1126] gfs2: Fix gfs2_file_buffered_write endless loop workaround Date: Tue, 5 Apr 2022 09:29:37 +0200 Message-Id: <20220405070437.712017452@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070407.513532867@linuxfoundation.org> References: <20220405070407.513532867@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@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; }