From: Mika Westerberg Date: Wed, 7 Oct 2020 14:06:17 +0000 (+0300) Subject: thunderbolt: Fix memory leak if ida_simple_get() fails in enumerate_services() X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=a663e0df4a374b8537562a44d1cecafb472cd65b;p=linux.git 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 --- diff --git a/drivers/thunderbolt/xdomain.c b/drivers/thunderbolt/xdomain.c index 48907853732ac..c00ad817042e1 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; }