Re: [PATCH] xfs: fix a resource leak in xfs_alloc_buftarg()
From: Darrick J. Wong
Date: Wed Apr 01 2026 - 00:21:55 EST
On Wed, Apr 01, 2026 at 12:02:41PM +0800, Haoxiang Li wrote:
> In the error path, call fs_put_dax() to drop the DAX
> device reference.
>
> Fixes: 6f643c57d57c ("xfs: implement ->notify_failure() for XFS")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Haoxiang Li <lihaoxiang@xxxxxxxxxxxxxxxx>
Yep, that's definitely a leak...
Reviewed-by: "Darrick J. Wong" <djwong@xxxxxxxxxx>
--D
> ---
> fs/xfs/xfs_buf.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
> index 47edf3041631..1ca95ef46a73 100644
> --- a/fs/xfs/xfs_buf.c
> +++ b/fs/xfs/xfs_buf.c
> @@ -1831,6 +1831,7 @@ xfs_alloc_buftarg(
> return btp;
>
> error_free:
> + fs_put_dax(btp->bt_daxdev, mp);
> kfree(btp);
> return ERR_PTR(error);
> }
> --
> 2.25.1
>