linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] thunderbolt: debugfs: Fix dentry reference leaks in margining_port_init
@ 2025-09-01  8:04 Miaoqian Lin
  2025-09-02  6:32 ` Mika Westerberg
  0 siblings, 1 reply; 2+ messages in thread
From: Miaoqian Lin @ 2025-09-01  8:04 UTC (permalink / raw)
  To: Andreas Noever, Michael Jamet, Mika Westerberg, Yehezkel Bernat,
	linux-usb, linux-kernel
  Cc: linmq006, stable

The debugfs_lookup() function returns a dentry with an increased
reference count that must be released by calling dput().

Fixes: d0f1e0c2a699 ("thunderbolt: Add support for receiver lane margining")
Cc: stable@vger.kernel.org
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
 drivers/thunderbolt/debugfs.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/thunderbolt/debugfs.c b/drivers/thunderbolt/debugfs.c
index f8328ca7e22e..2aadbec9a3e5 100644
--- a/drivers/thunderbolt/debugfs.c
+++ b/drivers/thunderbolt/debugfs.c
@@ -1770,6 +1770,7 @@ static void margining_port_init(struct tb_port *port)
 	port->usb4->margining = margining_alloc(port, &port->usb4->dev,
 						USB4_SB_TARGET_ROUTER, 0,
 						parent);
+	dput(parent);
 }
 
 static void margining_port_remove(struct tb_port *port)
-- 
2.35.1


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

* Re: [PATCH] thunderbolt: debugfs: Fix dentry reference leaks in margining_port_init
  2025-09-01  8:04 [PATCH] thunderbolt: debugfs: Fix dentry reference leaks in margining_port_init Miaoqian Lin
@ 2025-09-02  6:32 ` Mika Westerberg
  0 siblings, 0 replies; 2+ messages in thread
From: Mika Westerberg @ 2025-09-02  6:32 UTC (permalink / raw)
  To: Miaoqian Lin
  Cc: Andreas Noever, Michael Jamet, Mika Westerberg, Yehezkel Bernat,
	linux-usb, linux-kernel, stable

On Mon, Sep 01, 2025 at 04:04:37PM +0800, Miaoqian Lin wrote:
> The debugfs_lookup() function returns a dentry with an increased
> reference count that must be released by calling dput().

Don't we need the same for margining_port_remove() too?

> 
> Fixes: d0f1e0c2a699 ("thunderbolt: Add support for receiver lane margining")
> Cc: stable@vger.kernel.org
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
> ---
>  drivers/thunderbolt/debugfs.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/thunderbolt/debugfs.c b/drivers/thunderbolt/debugfs.c
> index f8328ca7e22e..2aadbec9a3e5 100644
> --- a/drivers/thunderbolt/debugfs.c
> +++ b/drivers/thunderbolt/debugfs.c
> @@ -1770,6 +1770,7 @@ static void margining_port_init(struct tb_port *port)
>  	port->usb4->margining = margining_alloc(port, &port->usb4->dev,
>  						USB4_SB_TARGET_ROUTER, 0,
>  						parent);
> +	dput(parent);
>  }
>  
>  static void margining_port_remove(struct tb_port *port)
> -- 
> 2.35.1

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

end of thread, other threads:[~2025-09-02  6:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-01  8:04 [PATCH] thunderbolt: debugfs: Fix dentry reference leaks in margining_port_init Miaoqian Lin
2025-09-02  6:32 ` Mika Westerberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).