Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp252400lqo; Thu, 9 May 2024 20:43:54 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWqSrOtQe3v1pEjsdekLzC3jI9EJEJpzwml9X+qeHQNwpLnNnkzdzNDrQ+2WKQ7espuAPZrWnJfRy7YDAk1ntUG4XdGKiCpazDFI9NybQ== X-Google-Smtp-Source: AGHT+IG6LviMH6tK1xJXYPU7d2aBI5JvaxOnpJA1mNc03iBYMaSemOr/+3yKaKdpIVHHg3pFke+T X-Received: by 2002:a05:620a:995:b0:792:9652:5a1d with SMTP id af79cd13be357-792c75ff3c3mr145105885a.66.1715312634001; Thu, 09 May 2024 20:43:54 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715312633; cv=pass; d=google.com; s=arc-20160816; b=h8SHFaL4rfvKlsn93IFLgslZBT47fMkwjHQ3bRtLno9EvKRHn2jZ2zLswHq7LdlM+0 yo4PRD1pYWnG+YJCy/oS81LwCgl0j5Y7ZvcxFQ7sr4P9YOI0w4HrqdUUurEcxrJpRU6G LMKUclcJ6gotKekEgEQwXvZwVJf8Mw8EnAuaNTbW8DVa2A/Kt0+ZuZBRu0ufv/6lRe+/ BlZqXijBB7L3GpsWvvqy/hRxsERyLO04Yq8GA1AdKfWGfzL89iUhvpsFf4csXSyDtnLR P19kKUVbQrs1uAMfSo6iwopi9n7wSBcbEWckxaBZlvXr6/i7RjPPVNJGUwJZKsmGm3pn 1+Eg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=6LzJ43WvAOHJxCE0K8BVemedBb4VsdOejNFQGDR0UhM=; fh=X1/oBJvTGJUQ0YtRp03u+3tPfRw/dXXALWynfOSlfQQ=; b=OlIa5EYCYZHjT4qehv3btOyBwv4wusKKDJ6yLCzvM+3d6A5curEcPQMkwdddbJYaR+ HR9w6JvqhwKyCW+sk+3mmgRb3bFtJVwTHSguhJ5ucbBwTcAShPEXgF20oDkqpXPKiV4x YfU41Dn/4PFvDpMKk+4btkQCo9regCy+SV9tpk7F705plBKKPhDcXRhkddi+RmvOCFSz phHRi/9WTav629RlzLHcxub7voxkz9Doh+EENEEIxZOcoekY59OVRakNbgYrN7uMU5DK VS9x8Ab9bdA/9HKTsvK1bc/5ZUy5H0sOaDrkLrUpSeJnytLTyoMMWkzCBHjKumM6BONz TtWQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jxJXsYrJ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-175263-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-175263-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id af79cd13be357-792bf2786f4si261814985a.129.2024.05.09.20.43.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 May 2024 20:43:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-175263-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jxJXsYrJ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-175263-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-175263-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id B76C01C20E78 for ; Fri, 10 May 2024 03:43:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 213DF149DEB; Fri, 10 May 2024 03:43:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="jxJXsYrJ" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4D097149C7B for ; Fri, 10 May 2024 03:43:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715312620; cv=none; b=rI/zJbEwIgHmipAgUmcQMT5HyC7/v+SH12qRnKf8reYH+39JvNvRpnnZ3ZMq/YP4I9//AJkRHm8ukVGtHpbc8HrjPBEy4xBymb/yl/teNtOCbSe6n4Z78gmKUFXJT5/i2xB0/sOlMFvXfPPAwO86xLZ8vImdhJRw3rLCECneH0M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715312620; c=relaxed/simple; bh=26S/wLyNbf+8N1bKoCdjjtV3ExKiUVLPx3+HHDN4lT8=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=s5HgDOD5F7R3ijpSquQA4xMwJmP/MJmyII+0BO8EdAUVzul1C60Dbzp1STlLWDhy6poMY1lLC1jBJj3ZCWTpc2NRb752QSrWyqnjykPXPjZTpB8Va+/06kvlU8ykCX5G6B+LGz7rvayxyhS+xNfNwXSPgNdkl+igORyFtRt4Hv4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=jxJXsYrJ; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5EF0FC113CC; Fri, 10 May 2024 03:43:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715312619; bh=26S/wLyNbf+8N1bKoCdjjtV3ExKiUVLPx3+HHDN4lT8=; h=From:To:Cc:Subject:Date:From; b=jxJXsYrJxzgp0rFoAf14zhFKuKl2CFtJl3j9DPQXefWPbOSBvDcGuHss8iBTy8dhk sDh1YsjLgJXNupOHbCJ841Tc4aCdtxnBiDTkodDU+3Jw/nINTVKleRRGSEPE8MhVj2 w7zgQmr1g6V/V+rfiyZzDIzSAszwMZmbfSr1lW7xbdmLb9uZjlsfYWLDUo8egchsvz RTPQwe2UzT6BrFbUqp5A1CBNF8hSHE72W+TqpN3gIssHlNtVopnMOPnixQ+mp2v947 nll9uYIeX4dNLmWpxnCxfWjZybdaJl+Z7WRigUMk7RSseuMFQc/Crx528LacIu11es WgaHvGh6XsDEg== From: Chao Yu To: jaegeuk@kernel.org Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, Chao Yu Subject: [PATCH v2 2/3] f2fs: fix to add missing iput() in gc_data_segment() Date: Fri, 10 May 2024 11:43:33 +0800 Message-Id: <20240510034333.358653-1-chao@kernel.org> X-Mailer: git-send-email 2.40.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit During gc_data_segment(), if inode state is abnormal, it missed to call iput(), fix it. Fixes: b73e52824c89 ("f2fs: reposition unlock_new_inode to prevent accessing invalid inode") Fixes: 9056d6489f5a ("f2fs: fix to do sanity check on inode type during garbage collection") Signed-off-by: Chao Yu --- v2: - fix wrong fixes tag line. fs/f2fs/gc.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c index ac4cbbe50c2f..6066c6eecf41 100644 --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c @@ -1554,10 +1554,15 @@ static int gc_data_segment(struct f2fs_sb_info *sbi, struct f2fs_summary *sum, int err; inode = f2fs_iget(sb, dni.ino); - if (IS_ERR(inode) || is_bad_inode(inode) || - special_file(inode->i_mode)) + if (IS_ERR(inode)) continue; + if (is_bad_inode(inode) || + special_file(inode->i_mode)) { + iput(inode); + continue; + } + err = f2fs_gc_pinned_control(inode, gc_type, segno); if (err == -EAGAIN) { iput(inode); -- 2.40.1