Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp230897pxj; Tue, 18 May 2021 01:58:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzslpVNZ+f6Q6JhelTT/+e5W5t73NfdJ5SGEJ760WufCd4ZohlkDX7PX4Ih+dmKg9u1YydV X-Received: by 2002:a6b:f808:: with SMTP id o8mr3479609ioh.140.1621328298480; Tue, 18 May 2021 01:58:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621328298; cv=none; d=google.com; s=arc-20160816; b=bwYFAlwYyCqSsZg1A17uGkuIm4K971Nmzs6mf+GomYcJ6nx6kQq0uLQsKSexiFGzD9 4tbXDK/hb0zXBz3eoG9c8d5GUEXCynwDd2uVBXSJbAxW4YkpwNhwJHAL3tty7ykJvjW5 EOnlbt/iM+Cd1TmA0qwGLbT+N+g/CpBVxzFKek7A/BiLfbzu8n6XxHCSvQaEZedRqdhh ZkX4e+bYspA5QLDukkcMybYm/XdsrISDEkaW4Q/zR5OafWo4gZ8y9jD3LrlzD/h3iU5N GyG0r7M4Swb/gMMTsvVEt/x10DXRQeJb19ajLeRl7OsplmboG/IpRN3K71XXttYQB2BG KOpg== 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=2DSmMJ7bNza2LMhxcwGiRz+PgRIJjl/LUc9Gri3QxwQ=; b=TiXHeLX1CFSTne92vc2WjNsHuG6/emLAjQuhPtRmpQ95YHFvDoBzcn5BokOsy30UFZ rNy6Yp0I+NDS8nBdt2hVOqf0tjhWAOShiDYBkwIagS/MNLT/u3w8IoiL/KOea9/WWoMG 67jBFEG7c1KTs5w7/NgjPU9OIGWAJjVfs71CBH9bxBNFEjvUXPvAm7lyb2Eeqnm9JsZn 8YAVSiLlns/iwZghy7wmoYj0d8Vxjr4QtOVeLWbldlTPjFyGxXahv6MwsV2r/27mo74I Fq1xOlR2LiaiU4skbdY8alZ9XNJZ3s5qasZhTlT4lzbXWq1UzzwPGePnN40I503lK4py AN8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vSJHOgL7; 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 y10si6890553jak.112.2021.05.18.01.58.06; Tue, 18 May 2021 01:58: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=vSJHOgL7; 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 S242529AbhEQPDt (ORCPT + 99 others); Mon, 17 May 2021 11:03:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:48472 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241921AbhEQOyQ (ORCPT ); Mon, 17 May 2021 10:54:16 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8629261992; Mon, 17 May 2021 14:24:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621261472; bh=UQybdjdzss65f7/YPov0bFeM1dGimb8qAfWrK+W3mJs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vSJHOgL7bFNmeoDZ7dPlpFes0f8GMx0461b0QZQF0lZmmGyTa09R70j4ceYopsVI/ QTgoA9AHbhOMV+9OToAl0WQN6LCZuu7ZnbKWLe56K1mn9c9+jZM+xcDy0/54C2Fo2+ BFMdr4NoXyErnr/ZMUnooYNUlQoQk7Jbx8Axo9w0= 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.11 117/329] f2fs: fix a redundant call to f2fs_balance_fs if an error occurs Date: Mon, 17 May 2021 16:00:28 +0200 Message-Id: <20210517140306.059847690@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140302.043055203@linuxfoundation.org> References: <20210517140302.043055203@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 993caefcd2bb..92652ca7a7c8 100644 --- a/fs/f2fs/inline.c +++ b/fs/f2fs/inline.c @@ -219,7 +219,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