netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net: thunderbolt: fix memory leak in tbnet_open()
@ 2022-12-05 11:55 Zhengchao Shao
  2022-12-05 13:38 ` Mika Westerberg
  0 siblings, 1 reply; 3+ messages in thread
From: Zhengchao Shao @ 2022-12-05 11:55 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(), it doesn't free ida.

Fixes: 180b0689425c ("thunderbolt: Allow multiple DMA tunnels over a single XDomain connection")
Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
---
 drivers/net/thunderbolt.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/thunderbolt.c b/drivers/net/thunderbolt.c
index a52ee2bf5575..70fd61ce15c6 100644
--- a/drivers/net/thunderbolt.c
+++ b/drivers/net/thunderbolt.c
@@ -916,6 +916,7 @@ static int tbnet_open(struct net_device *dev)
 		netdev_err(dev, "failed to allocate Rx ring\n");
 		tb_ring_free(net->tx_ring.ring);
 		net->tx_ring.ring = NULL;
+		tb_xdomain_release_out_hopid(xd, hopid);
 		return -ENOMEM;
 	}
 	net->rx_ring.ring = ring;
-- 
2.34.1


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

end of thread, other threads:[~2022-12-06  0:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-05 11:55 [PATCH net] net: thunderbolt: fix memory leak in tbnet_open() Zhengchao Shao
2022-12-05 13:38 ` Mika Westerberg
2022-12-06  0:46   ` shaozhengchao

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