Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3026032pxj; Mon, 17 May 2021 15:54:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz/aAS81U6DyT9K9y8Dp9ZXNuw8FLOpORQQY6iR3BNOHFBkwzZX5jAJdoHivLxDlKoJBDUs X-Received: by 2002:a6b:8b48:: with SMTP id n69mr1852938iod.165.1621292096265; Mon, 17 May 2021 15:54:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621292096; cv=none; d=google.com; s=arc-20160816; b=JlzFq2Azv4GSO3206rCPIWOePDHcjw19smsqZTH4jeXOeeEuF1O8vRcRXlASlJ1FAg iin9hymeRLRQGDVfRcDE7X+AmvvHv5r86tYfT1qzNa6UR2NiGC7i8pit+2JD5tkKe80R tQ10qkcFuP026h/l/mfPmKzsYCbn391ExPx83pV9uXiqD0qlUVeBxmpJZeN7YVM6QPTC cLwnNs18ADjLB9odr3zuRJVr5golNcYLXH4quH1TdNqEMaRwUXqxJv2KFlIHjZHkH1pG NgIbbdE/rWV5ZOwVHQcG4OO3mre3eWJh9MAuejnvMVh63FrKwpxQ5de3XxqU9FmscNut Omsg== 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=ShGgtk3X7wkJJjB7pIaROkZkTPKsEJA74ROroIFaILdZRi9WUR35INbAmUQsjV8i6L 8wpE1jBX/ViY9bATt2Hqbo6QodjNXpfututT3A9+fJ9uNzcbmijitk/qm6RYG+wsA2+d l2sw9eZ2Z4gowlGK2TZlzpoNz0UHe2zS9NfOKHiLOmGhdHaPEpv73Ol651Xy4QYtk/5f 2w1JnjJScIGoPbYr0N2R21vY3j/pmsxn004t3/MPrDCZ3HIH06WBslcMU8WFDm8aoyv+ HvuEdId59Caa8UZVGcoN8gmOF710xjmRbpXZaxhOOp9YWiBAw0RcLxoOgaddEDnMdqiV 3ayw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AkOMcMxi; 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 a27si20800455jab.118.2021.05.17.15.54.21; Mon, 17 May 2021 15:54:56 -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=AkOMcMxi; 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 S234128AbhEQORW (ORCPT + 99 others); Mon, 17 May 2021 10:17:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:46662 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239035AbhEQOOq (ORCPT ); Mon, 17 May 2021 10:14:46 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0BA3A60720; Mon, 17 May 2021 14:09:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621260546; bh=UQybdjdzss65f7/YPov0bFeM1dGimb8qAfWrK+W3mJs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AkOMcMxih/ncki3RHErq62t6kaWGN30fmmJE1lnvJ+RXwM0fjf/ER4pxQs8Rd5lBB buebtYBpJERY/FIDxnWkKsg9fmhyjuz8VxpEb+QPPrkLiietsTSaKEekFLSv7GWDVA Hn7yHM2I75asp3udvwrLLV+WLjAzl65Ylc0mVAXk= 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.12 130/363] f2fs: fix a redundant call to f2fs_balance_fs if an error occurs Date: Mon, 17 May 2021 15:59:56 +0200 Message-Id: <20210517140307.021401676@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140302.508966430@linuxfoundation.org> References: <20210517140302.508966430@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