From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E0F16C6FA86 for ; Mon, 26 Sep 2022 11:19:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237674AbiIZLTn (ORCPT ); Mon, 26 Sep 2022 07:19:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43418 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237444AbiIZLSM (ORCPT ); Mon, 26 Sep 2022 07:18:12 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B7EA65673; Mon, 26 Sep 2022 03:38:13 -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 ams.source.kernel.org (Postfix) with ESMTPS id EFDA9B80957; Mon, 26 Sep 2022 10:38:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4CF4AC433D7; Mon, 26 Sep 2022 10:38:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664188685; bh=CME+exr/BiZwbfHj3Ck2tTxmIjQN46Qf/f3jVKEcMmo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P0o8iwTTGJkFwYrwyYqw0rwz1VoSfXCQrCt04fte5r5dHLoJD3J7PQzmaLBAJ+DNp w3qBqQt1rIfnKnxGUe7TtjxTLfEQgY5hq61NkzXzFneH/mZaHfSChf06kXSuMD/dbc yf/VkO3imFlHg2Jqa35vk++UkhnOAJHOcjQzrPPo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , Brian Foster , "Darrick J. Wong" , Dave Chinner , Dave Chinner , Leah Rumancik Subject: [PATCH 5.15 056/148] xfs: fix xfs_ifree() error handling to not leak perag ref Date: Mon, 26 Sep 2022 12:11:30 +0200 Message-Id: <20220926100758.133194611@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100756.074519146@linuxfoundation.org> References: <20220926100756.074519146@linuxfoundation.org> User-Agent: quilt/0.67 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: Brian Foster [ Upstream commit 6f5097e3367a7c0751e165e4c15bc30511a4ba38 ] For some reason commit 9a5280b312e2e ("xfs: reorder iunlink remove operation in xfs_ifree") replaced a jump to the exit path in the event of an xfs_difree() error with a direct return, which skips releasing the perag reference acquired at the top of the function. Restore the original code to drop the reference on error. Fixes: 9a5280b312e2e ("xfs: reorder iunlink remove operation in xfs_ifree") Signed-off-by: Brian Foster Reviewed-by: Darrick J. Wong Reviewed-by: Dave Chinner Signed-off-by: Dave Chinner Signed-off-by: Leah Rumancik Acked-by: Darrick J. Wong Signed-off-by: Greg Kroah-Hartman --- fs/xfs/xfs_inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c @@ -2634,7 +2634,7 @@ xfs_ifree( */ error = xfs_difree(tp, pag, ip->i_ino, &xic); if (error) - return error; + goto out; error = xfs_iunlink_remove(tp, pag, ip); if (error)