Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp557695pxj; Thu, 20 May 2021 16:10:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx4JPd1TUe7W1OcR9w2pUbWiKqQMp/el89gZvlU0Yyjc7orCeIhVovNi4fSUtXtL/M059d+ X-Received: by 2002:a17:906:854e:: with SMTP id h14mr6912788ejy.455.1621552245937; Thu, 20 May 2021 16:10:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621552245; cv=none; d=google.com; s=arc-20160816; b=vg9swGZ8PCyGwdXU7umbbfVoDPmE7xIXlxyTzRXuIl6CFk8rbec7msuYJ3bvfMp47V 91JcJFR+a2LCmtjIbP+hAzXJ0+xDVVW0OE/ckP4PWrjGXWkPhNToqMG0WIE9YMsFt7M4 xp6tGETmHm8NrhjTtuOBLeZf/KbIgGKEsYL8xCYhMm2g8osm8qYZtMwwJrnjvfjKnv2p gbD5L4lB+jTDZiwG6Dddk65gc5gHJvoL2O8GQDq3Y/+S8jn7hCijgfrhBRjaSyEpgaIO b5U3XawqxfW022wXNGTxvEaZXouCfPV0a2BuRWhd0681a0RKjCD68bc90N91auIBz/Yd +iAg== 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=gIi2wMdqOSI0pNdeczB8soEf0UhiggtjnEomjIiDU/E=; b=CGaxZ1h5x9v7Ior8g8Awpi8tU7vgUUjPcbTfAv3wlX5kYos+fLYc1fiEV10RSEytYD 3jydsJUuOmeXqfgnHlRA/XFCie0xqFp1WnCccqfH7LgjPr6saXbnjVTtT834QkHCHBIe 7wvbAdTyoyZ/PJApyOatHyEhZyQq7wzXhYon3RDNaQMnVeoslT5+d3RZsPBhk6pcVHDN NDUuIdxrMjojG0nkCKgUEPEaNJuqW39f89NaToN5BlkQ/F82Li0OaqVdnQJIwif0KOIf RuIp5eICUnIGkmhWQGKGHBVX0PapsjqjAYNHiXoXODFOrqp9wwW5LGnpiFkLBux5fZgV 4JEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hndYyoTi; 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 o15si3383490edc.604.2021.05.20.16.10.21; Thu, 20 May 2021 16:10:45 -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=hndYyoTi; 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 S241140AbhETLWA (ORCPT + 99 others); Thu, 20 May 2021 07:22:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:57140 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238974AbhETLB5 (ORCPT ); Thu, 20 May 2021 07:01:57 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3BCAC61D0D; Thu, 20 May 2021 10:03:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621505031; bh=XYQPbT2/nh1qXOxzHrB7JbpxI31hnd3KzjabaIYCqAg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hndYyoTixxh7qIKZtxRgGgbMjyJzl9gEtfI20xR3sQHGhy+CJPC0bTzWqEo27wiI/ aspZg4k9jKoqm5YOZnxg+9NJaQ6XEPSTLqV0wpZ+IND+psTJClJQEIavdJpS5mEByO hbJuhVDJDSat7FN5zGLk1/rP/3ejo22piH62KL8k= 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.9 192/240] f2fs: fix a redundant call to f2fs_balance_fs if an error occurs Date: Thu, 20 May 2021 11:23:04 +0200 Message-Id: <20210520092115.115609478@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092108.587553970@linuxfoundation.org> References: <20210520092108.587553970@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 482888ee8942..481fae63f163 100644 --- a/fs/f2fs/inline.c +++ b/fs/f2fs/inline.c @@ -196,7 +196,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