Skip to content

Commit ed14e59

Browse files
zhengchaoshaokuba-moo
authored andcommitted
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: 180b068 ("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>
1 parent 803e848 commit ed14e59

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

drivers/net/thunderbolt.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -914,6 +914,7 @@ static int tbnet_open(struct net_device *dev)
914914
eof_mask, tbnet_start_poll, net);
915915
if (!ring) {
916916
netdev_err(dev, "failed to allocate Rx ring\n");
917+
tb_xdomain_release_out_hopid(xd, hopid);
917918
tb_ring_free(net->tx_ring.ring);
918919
net->tx_ring.ring = NULL;
919920
return -ENOMEM;

0 commit comments

Comments
 (0)