Received: by 2002:a05:6520:4211:b029:f4:110d:56bc with SMTP id o17csp2120539lkv; Thu, 20 May 2021 03:54:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxZGuyqvODJ+FGH/QuVrgk4x35JCoUNHNRdzCC4uO/y3Dr8MnhjQzFODPCM2S5YaFFvdKq4 X-Received: by 2002:a05:6402:19a:: with SMTP id r26mr4272428edv.44.1621508058092; Thu, 20 May 2021 03:54:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621508058; cv=none; d=google.com; s=arc-20160816; b=vXH/m1vIhSCT5wjyBn/uuOznK1Kkcma2ZOdsBpf1ntw3ugSMRgroGL8QCvvH1A2XSy lZymSu1Wu6eV8BXIba2vyfdtgaUnQeYnofJIds4b7dBkqyhIIsceoHay5SMY0eGTG0IK vL9CfV/zMeeRQLOo+DULQzfsEECvTHRKwaJtMtEV1V43rUPmm/k9Dpx7yCVn6v9oHUfa 6AV5Op/DY0pMrMNJfy3BYgUnpbk3r/BAKUaOA5Pd1+FA6Bq4ztx6ngLiQQvvScZqLSOg /FEBZblaKCpbw1L78eKOhyIrrvvxhD5xHqEpEj9/8giPT5NTBlLxZODZQY9F86AZahoI zu7w== 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=kj84FZzmaYi7OEqyeqU132x4onqM1n6JmqPgrgdZ1w0=; b=w1yAJIZoLtWI/7M3SEDj/T64cUmlyr7Mhi1USacMJCkV98gJMn21Njp0Izal4+lbgD +Gw4WytXxO2dGiCuqXqXkOZTmxhy1lhfvBbx6t1GuJxt6SuXIrEfWPDm4iTf/eI1qN0m jICfCfkVBagTEyBOa+eI5QXKcSiKXkpk14FNItgxPCw/vi3W4uVGdOoCW3uCl52e4Djy ZLVgl08rSuLhvwo+mehXjVi/sfS0UqSpG4f1SNlagXqjQcWWyecoW+OYxTbTKmDwCVl7 H/hqUNWJjcV7PghXXKuwubKc1Ty0S+6va8vBmzA1MuZnXBmBwE6zh4EtfTlKaQmkNEx5 Fa3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OmUeblSm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id md11si2113536ejb.212.2021.05.20.03.53.44; Thu, 20 May 2021 03:54:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OmUeblSm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.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: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238507AbhETKwq (ORCPT + 99 others); Thu, 20 May 2021 06:52:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:39816 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237029AbhETKhh (ORCPT ); Thu, 20 May 2021 06:37:37 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4230761C6E; Thu, 20 May 2021 09:54:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621504468; bh=zuYue1qlKmWu/hX0P2NKY6ebYP5eUaBn+QVoYt12324=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OmUeblSmCiBteShpWeDsgmGgoWk3X0i1kK6lU5nYh+kN2lPecS34LhojRa/dU7sRU +Cu7Y//AAhTZmZcQfnTJTEQhAcrB1yMkEKqNFgAZ6reVF0XpJtkxNsS1AB/8WL2AtK hN+I/WOGwOEdbDeclo6jfCOY9h9KehnmkHbo3KiI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Colin Ian King , Chao Yu , Jaegeuk Kim , Sasha Levin Subject: [PATCH 4.14 259/323] f2fs: fix a redundant call to f2fs_balance_fs if an error occurs Date: Thu, 20 May 2021 11:22:31 +0200 Message-Id: <20210520092129.079045453@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092120.115153432@linuxfoundation.org> References: <20210520092120.115153432@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Colin Ian King [ Upstream commit 28e18ee636ba28532dbe425540af06245a0bbecb ] The uninitialized variable dn.node_changed does not get set when a call to f2fs_get_node_page fails. This uninitialized value gets used in the call to f2fs_balance_fs() that may or not may not balances dirty node and dentry pages depending on the uninitialized state of the variable. Fix this by only calling f2fs_balance_fs if err is not set. Thanks to Jaegeuk Kim for suggesting an appropriate fix. Addresses-Coverity: ("Uninitialized scalar variable") Fixes: 2a3407607028 ("f2fs: call f2fs_balance_fs only when node was changed") Signed-off-by: Colin Ian King Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Sasha Levin --- fs/f2fs/inline.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/inline.c b/fs/f2fs/inline.c index 8906f6381b1a..74bc861bab39 100644 --- a/fs/f2fs/inline.c +++ b/fs/f2fs/inline.c @@ -203,7 +203,8 @@ out: f2fs_put_page(page, 1); - f2fs_balance_fs(sbi, dn.node_changed); + if (!err) + f2fs_balance_fs(sbi, dn.node_changed); return err; } -- 2.30.2