Linux XFS filesystem development
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: Brian Foster <bfoster@redhat.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH] xfs: fix xfs_ifree() error handling to not leak perag ref
Date: Fri, 27 May 2022 09:12:01 -0700	[thread overview]
Message-ID: <YpD4UQRIefSW8s2O@magnolia> (raw)
In-Reply-To: <20220527133428.2291945-1-bfoster@redhat.com>

On Fri, May 27, 2022 at 09:34:28AM -0400, Brian Foster wrote:
> 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 <bfoster@redhat.com>

Doh.  Good catch!
Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> ---
>  fs/xfs/xfs_inode.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
> index b2879870a17e..52d6f2c7d58b 100644
> --- a/fs/xfs/xfs_inode.c
> +++ b/fs/xfs/xfs_inode.c
> @@ -2622,7 +2622,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)
> -- 
> 2.34.1
> 

  reply	other threads:[~2022-05-27 16:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-27 13:34 [PATCH] xfs: fix xfs_ifree() error handling to not leak perag ref Brian Foster
2022-05-27 16:12 ` Darrick J. Wong [this message]
2022-05-27 22:42 ` Dave Chinner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YpD4UQRIefSW8s2O@magnolia \
    --to=djwong@kernel.org \
    --cc=bfoster@redhat.com \
    --cc=linux-xfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox