Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp379631pxj; Tue, 18 May 2021 05:36:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwz86DpgAsFTyaKA1AkNaCKFOt/DEbxMUbw9LHxCkRocLp2SW1sGXqrA9JFYSpBKqBuQk4g X-Received: by 2002:a17:906:e096:: with SMTP id gh22mr5834425ejb.101.1621341378558; Tue, 18 May 2021 05:36:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621341378; cv=none; d=google.com; s=arc-20160816; b=Q2PRvGtbQy7/1PDuEzrVzM98CuGsgc4y23Yr33xwI96jedwIKFVANLKN5yHHAiMyWo krxCqbAyA7IXNo65xcUAPjeBFxK5j94kPBKjU8AHx/fpmatRS6qYwpS1ftsxrWsTRSPy DTa3a3f4E+Z6879NskbDzhe3+b3mlC1utvhGY+XtZT97eQ8+2XZob8CiEwb1J9azU/NX Zi6ERfiym8YUs9npdn6Sjt6cfKKfpAjHW78zzF/0qN5H6lpfK5/sjUuNaS47TnYPx3aZ xbCRToRLwLqcWLCp1B/uWeOiPE10BCVKwuXBsyBv+08OZO0RppfqZ9ivGJVO21rvtP3W H+8g== 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=PJt2k6aOQf8WLtl76wyPOguXogBQtcaxpXpomTi5fjg=; b=JMlSwOQyuvF/UPkA4jXTCohZj4wjk74haJM7x/S71pooBjqduFM/F6RLhTQu6hKA16 EVNUakpe+cUKkTy5yOOSNJSsD2yd1Q6rAQRCB/rxUFaqhhbUiYBkIz/spNmWfW01U/Lj MsKX/DnszFnzfJ3LwEXIueQJ7l/wX8gbT4izL5tGxXGwC80GJkOl+dFVpnxdYnl8cLVX spHLpM6alXcK5ZAtOs5f/ki3mLYUGLnVVMuIBtBYsfIV2zbFZnCAr2GyRFiscG4oETsf mkvMzWYzkzy/Go0hfEwZzbxr0+lrAas5mNGgqAcw2/sA953gKlgFo9YPD2KTGxfJ4wSg OYGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qsjHIHEy; 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 la26si6410907ejb.524.2021.05.18.05.35.55; Tue, 18 May 2021 05:36: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=qsjHIHEy; 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 S243133AbhEQPeA (ORCPT + 99 others); Mon, 17 May 2021 11:34:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:55934 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243878AbhEQPSj (ORCPT ); Mon, 17 May 2021 11:18:39 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 501EB61C6D; Mon, 17 May 2021 14:33:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621262015; bh=lRHZAkPNnB3u0zdGDlu72WVES0PxqvkLZbc7RzB4zDA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qsjHIHEy0IF2JwVbqD0BH7l3JfWYtR18WqFj+E4e/ZyF7GxWDCmQHNpBdbtliilkf nujSPQDoNmkf86yj6je+gMkIRBBNPIj4Z72U7FEu3ExGCfB2DKdPNogH6wRJaKpgFn hcG3+7AeAqnmqDGmsjGo94ZPc15BaxlvJBuy8Ews= 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 5.10 099/289] f2fs: fix a redundant call to f2fs_balance_fs if an error occurs Date: Mon, 17 May 2021 16:00:24 +0200 Message-Id: <20210517140308.523384837@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140305.140529752@linuxfoundation.org> References: <20210517140305.140529752@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 b9e37f0b3e09..1d7dafdaffe3 100644 --- a/fs/f2fs/inline.c +++ b/fs/f2fs/inline.c @@ -218,7 +218,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