summaryrefslogtreecommitdiff
path: root/drivers/net/thunderbolt.c
diff options
context:
space:
mode:
authorZhengchao Shao <shaozhengchao@huawei.com>2022-12-07 04:50:01 +0300
committerJakub Kicinski <kuba@kernel.org>2022-12-08 20:07:37 +0300
commited14e5903638f6eb868e3e2b4e610985e6a6c876 (patch)
tree46094f7780135153e26e673f10edaf48e71d1303 /drivers/net/thunderbolt.c
parent803e84867de59a1e5d126666d25eb4860cfd2ebe (diff)
downloadlinux-ed14e5903638f6eb868e3e2b4e610985e6a6c876.tar.xz
net: thunderbolt: fix memory leak in tbnet_open()
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> Link: https://lore.kernel.org/r/20221207015001.1755826-1-shaozhengchao@huawei.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers/net/thunderbolt.c')
-rw-r--r--drivers/net/thunderbolt.c1
1 files changed, 1 insertions, 0 deletions
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;