提交 050060e0 编写于 作者: M Mika Westerberg 提交者: Yang Yingliang

thunderbolt: Fix memory leak if ida_simple_get() fails in enumerate_services()

commit a663e0df upstream.

The svc->key field is not released as it should be if ida_simple_get()
fails so fix that.

Fixes: 9aabb685 ("thunderbolt: Fix to check return value of ida_simple_get")
Cc: stable@vger.kernel.org
Signed-off-by: NMika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 2db7fb1b
...@@ -774,6 +774,7 @@ static void enumerate_services(struct tb_xdomain *xd) ...@@ -774,6 +774,7 @@ static void enumerate_services(struct tb_xdomain *xd)
id = ida_simple_get(&xd->service_ids, 0, 0, GFP_KERNEL); id = ida_simple_get(&xd->service_ids, 0, 0, GFP_KERNEL);
if (id < 0) { if (id < 0) {
kfree(svc->key);
kfree(svc); kfree(svc);
break; break;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册