net: thunderbolt: fix memory leak in tbnet_open()
authorZhengchao Shao <shaozhengchao@huawei.com>
Wed, 7 Dec 2022 01:50:01 +0000 (09:50 +0800)
committerJakub Kicinski <kuba@kernel.org>
Thu, 8 Dec 2022 17:07:37 +0000 (09:07 -0800)
commited14e5903638f6eb868e3e2b4e610985e6a6c876
tree46094f7780135153e26e673f10edaf48e71d1303
parent803e84867de59a1e5d126666d25eb4860cfd2ebe
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>
drivers/net/thunderbolt.c