summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMika Westerberg <mika.westerberg@linux.intel.com>2020-10-07 17:06:17 +0300
committerMika Westerberg <mika.westerberg@linux.intel.com>2020-11-05 13:32:40 +0300
commita663e0df4a374b8537562a44d1cecafb472cd65b (patch)
tree5f94ba9fa3752015956340416722f5161c4ef414
parent7342ca34d931a357d408aaa25fadd031e46af137 (diff)
downloadlinux-a663e0df4a374b8537562a44d1cecafb472cd65b.tar.xz
thunderbolt: Fix memory leak if ida_simple_get() fails in enumerate_services()
The svc->key field is not released as it should be if ida_simple_get() fails so fix that. Fixes: 9aabb68568b4 ("thunderbolt: Fix to check return value of ida_simple_get") Cc: stable@vger.kernel.org Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
-rw-r--r--drivers/thunderbolt/xdomain.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/thunderbolt/xdomain.c b/drivers/thunderbolt/xdomain.c
index 48907853732a..c00ad817042e 100644
--- a/drivers/thunderbolt/xdomain.c
+++ b/drivers/thunderbolt/xdomain.c
@@ -881,6 +881,7 @@ static void enumerate_services(struct tb_xdomain *xd)
id = ida_simple_get(&xd->service_ids, 0, 0, GFP_KERNEL);
if (id < 0) {
+ kfree(svc->key);
kfree(svc);
break;
}