netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net v3] net: thunderbolt: fix memory leak in tbnet_open()
@ 2022-12-07  1:50 Zhengchao Shao
  2022-12-07 13:49 ` Jiri Pirko
  2022-12-08 17:10 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Zhengchao Shao @ 2022-12-07  1:50 UTC (permalink / raw)
  To: netdev, michael.jamet, mika.westerberg, YehezkelShB, davem,
	edumazet, kuba, pabeni
  Cc: weiyongjun1, yuehaibing, shaozhengchao

When tb_ring_alloc_rx() failed in tbnet_open(), ida that allocated in
tb_xdomain_alloc_out_hopid() is not released. Add
tb_xdomain_release_out_hopid() to the error path to release ida.

Fixes: 180b0689425c ("thunderbolt: Allow multiple DMA tunnels over a single XDomain connection")
Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
---
v3: add patch description
v2: move release ida before free tx_ring
---
 drivers/net/thunderbolt.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/thunderbolt.c b/drivers/net/thunderbolt.c
index a52ee2bf5575..6312f67f260e 100644
--- a/drivers/net/thunderbolt.c
+++ b/drivers/net/thunderbolt.c
@@ -914,6 +914,7 @@ static int tbnet_open(struct net_device *dev)
 				eof_mask, tbnet_start_poll, net);
 	if (!ring) {
 		netdev_err(dev, "failed to allocate Rx ring\n");
+		tb_xdomain_release_out_hopid(xd, hopid);
 		tb_ring_free(net->tx_ring.ring);
 		net->tx_ring.ring = NULL;
 		return -ENOMEM;
-- 
2.34.1


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

* Re: [PATCH net v3] net: thunderbolt: fix memory leak in tbnet_open()
  2022-12-07  1:50 [PATCH net v3] net: thunderbolt: fix memory leak in tbnet_open() Zhengchao Shao
@ 2022-12-07 13:49 ` Jiri Pirko
  2022-12-08 17:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Jiri Pirko @ 2022-12-07 13:49 UTC (permalink / raw)
  To: Zhengchao Shao
  Cc: netdev, michael.jamet, mika.westerberg, YehezkelShB, davem,
	edumazet, kuba, pabeni, weiyongjun1, yuehaibing

Wed, Dec 07, 2022 at 02:50:01AM CET, shaozhengchao@huawei.com wrote:
>When tb_ring_alloc_rx() failed in tbnet_open(), ida that allocated in
>tb_xdomain_alloc_out_hopid() is not released. Add
>tb_xdomain_release_out_hopid() to the error path to release ida.
>
>Fixes: 180b0689425c ("thunderbolt: Allow multiple DMA tunnels over a single XDomain connection")
>Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
>Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>

Reviewed-by: Jiri Pirko <jiri@nvidia.com>

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

* Re: [PATCH net v3] net: thunderbolt: fix memory leak in tbnet_open()
  2022-12-07  1:50 [PATCH net v3] net: thunderbolt: fix memory leak in tbnet_open() Zhengchao Shao
  2022-12-07 13:49 ` Jiri Pirko
@ 2022-12-08 17:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-12-08 17:10 UTC (permalink / raw)
  To: Zhengchao Shao
  Cc: netdev, michael.jamet, mika.westerberg, YehezkelShB, davem,
	edumazet, kuba, pabeni, weiyongjun1, yuehaibing

Hello:

This patch was applied to netdev/net.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Wed, 7 Dec 2022 09:50:01 +0800 you wrote:
> When tb_ring_alloc_rx() failed in tbnet_open(), ida that allocated in
> tb_xdomain_alloc_out_hopid() is not released. Add
> tb_xdomain_release_out_hopid() to the error path to release ida.
> 
> Fixes: 180b0689425c ("thunderbolt: Allow multiple DMA tunnels over a single XDomain connection")
> Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
> 
> [...]

Here is the summary with links:
  - [net,v3] net: thunderbolt: fix memory leak in tbnet_open()
    https://git.kernel.org/netdev/net/c/ed14e5903638

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2022-12-08 17:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-07  1:50 [PATCH net v3] net: thunderbolt: fix memory leak in tbnet_open() Zhengchao Shao
2022-12-07 13:49 ` Jiri Pirko
2022-12-08 17:10 ` patchwork-bot+netdevbpf

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