Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp595657pxb; Tue, 5 Apr 2022 15:21:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzsHgpqRB5pCWopclTADKeBwrzY8zK6GmSK2mXvC1fauqTFvZz1teg/0CW1FwJcZZL6VUBW X-Received: by 2002:a17:902:ccc6:b0:156:a94a:9db4 with SMTP id z6-20020a170902ccc600b00156a94a9db4mr5566392ple.45.1649197296258; Tue, 05 Apr 2022 15:21:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649197296; cv=none; d=google.com; s=arc-20160816; b=iJe46fp8bPhTCF5YvHJXi15EAWS/eP5RnYjTxt+0xYjrwZU6MyJKXG5Z8gZHgt724M QQCf0BEt/7W2+TC2QInld9j2x1fdjzz43TC2zvI85cwrWy2LDuVOtH1IT/xwrbK8X0ka 8P9v9zfv8kfjrborS9ol7mRBdM85LS0coVbDeiI+aoYcbvk6tPiOVWzywYsWXoyDD9wK ctuuWMSAXzFq9U9jjI1c8GHfzpWtnEhqNK10q0oxKxfaYWT2JCH5UNkbuZlOR5D0vbe9 5ZrrnVKttNM5lcRnj79cqblFaosKoU5rZFnMqVJjRF877N25AM5HQ0ZAIuZSVJg/ACPg X9XA== 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=yhU7bQ8HYFxqyGJnZJCsih3tmy35AsCw9xAV2w5pB3M=; b=iu1ukw9XYFoIzHbohbcUieaoDG6HcxG5U+TceN6zweMIMG9TIxa7ySeT+P41E13vBR ZyNuDL0rPBnbnL1tvzTCjbEa+l6yKyFpueadlJvTHlccmuQxSV5nmdFxCjBd75O55S06 v6ts/TK8LklDS1uhUf4Py4Yw75tAJih/6d0he4eYZ/kv4AM74NxNwKtkf7Pbz/MDH5xS Aa6CgB1bOd8HQpmSTHzzv4bULPkJQ2ZEmpu2AjAMdYYMTwCwnMW3nngNfrwf2e8isjVr NGocJqn2voWNUxjFJJK02aZ+6sDNWxqfqGziHjDl4kwzlNdwqwV5aqI8dgOlG8BZ4pS8 7n9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XH6KaJVq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id i14-20020a170902c94e00b00153b2d16407si15266965pla.15.2022.04.05.15.21.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Apr 2022 15:21:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XH6KaJVq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id F14E6136C3E; Tue, 5 Apr 2022 15:03:36 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1386900AbiDEO0X (ORCPT + 99 others); Tue, 5 Apr 2022 10:26:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238956AbiDEJdN (ORCPT ); Tue, 5 Apr 2022 05:33:13 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F869659B; Tue, 5 Apr 2022 02:21:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 9A0A5CE1C6A; Tue, 5 Apr 2022 09:21:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AC0C9C385A0; Tue, 5 Apr 2022 09:21:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649150471; bh=WaWtMQ1moedWleGc2K2Obq1MHj8BngFuX5HUmVv0cSk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XH6KaJVqj/62SjNfYpAw+pUoN7RQm0ncNHlYQkD99PQSM1GBj3nu2IuZ0eTJjaiWH keHdp/awUgeItESOVToFI+aVrpyUwlpbUi0NuwhNvBOePdxIp343n57iu6mXAdwNmZ eEuZCi9F2o43Geu8oR22Q8buoDoC/mQ0BzfEMIhM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Machek , Chao Yu , Jaegeuk Kim Subject: [PATCH 5.15 067/913] f2fs: fix to unlock page correctly in error path of is_alive() Date: Tue, 5 Apr 2022 09:18:49 +0200 Message-Id: <20220405070341.831433895@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070339.801210740@linuxfoundation.org> References: <20220405070339.801210740@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chao Yu commit 6d18762ed5cd549fde74fd0e05d4d87bac5a3beb upstream. As Pavel Machek reported in below link [1]: After commit 77900c45ee5c ("f2fs: fix to do sanity check in is_alive()"), node page should be unlock via calling f2fs_put_page() in the error path of is_alive(), otherwise, f2fs may hang when it tries to lock the node page, fix it. [1] https://lore.kernel.org/stable/20220124203637.GA19321@duo.ucw.cz/ Fixes: 77900c45ee5c ("f2fs: fix to do sanity check in is_alive()") Cc: Reported-by: Pavel Machek Signed-off-by: Pavel Machek Signed-off-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Greg Kroah-Hartman --- fs/f2fs/gc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c @@ -1023,8 +1023,10 @@ static bool is_alive(struct f2fs_sb_info set_sbi_flag(sbi, SBI_NEED_FSCK); } - if (f2fs_check_nid_range(sbi, dni->ino)) + if (f2fs_check_nid_range(sbi, dni->ino)) { + f2fs_put_page(node_page, 1); return false; + } *nofs = ofs_of_node(node_page); source_blkaddr = data_blkaddr(NULL, node_page, ofs_in_node);