public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfs: fix a resource leak in xfs_alloc_buftarg()
@ 2026-04-01  4:02 Haoxiang Li
  2026-04-01  4:21 ` Darrick J. Wong
  0 siblings, 1 reply; 2+ messages in thread
From: Haoxiang Li @ 2026-04-01  4:02 UTC (permalink / raw)
  To: cem, ruansy.fnst, akpm, djwong
  Cc: linux-xfs, linux-kernel, Haoxiang Li, stable

In the error path, call fs_put_dax() to drop the DAX
device reference.

Fixes: 6f643c57d57c ("xfs: implement ->notify_failure() for XFS")
Cc: stable@vger.kernel.org
Signed-off-by: Haoxiang Li <lihaoxiang@isrc.iscas.ac.cn>
---
 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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] xfs: fix a resource leak in xfs_alloc_buftarg()
  2026-04-01  4:02 [PATCH] xfs: fix a resource leak in xfs_alloc_buftarg() Haoxiang Li
@ 2026-04-01  4:21 ` Darrick J. Wong
  0 siblings, 0 replies; 2+ messages in thread
From: Darrick J. Wong @ 2026-04-01  4:21 UTC (permalink / raw)
  To: Haoxiang Li; +Cc: cem, ruansy.fnst, akpm, linux-xfs, linux-kernel, stable

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@vger.kernel.org
> Signed-off-by: Haoxiang Li <lihaoxiang@isrc.iscas.ac.cn>

Yep, that's definitely a leak...
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>

--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
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-04-01  4:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-01  4:02 [PATCH] xfs: fix a resource leak in xfs_alloc_buftarg() Haoxiang Li
2026-04-01  4:21 ` Darrick J. Wong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox