]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
thunderbolt: Keep XDomain reference during the lifetime of a service
authorMika Westerberg <mika.westerberg@linux.intel.com>
Mon, 8 Sep 2025 10:31:29 +0000 (13:31 +0300)
committerMika Westerberg <mika.westerberg@linux.intel.com>
Tue, 5 May 2026 11:53:46 +0000 (13:53 +0200)
This is needed because we release the service ID in tb_service_release()
and the ID array is owned by the parent XDomain.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
drivers/thunderbolt/xdomain.c

index a1887a15a2849d8cc1d70cd4c0fac21acfdb122c..0e97d0ad7733d219dedca7d2a0b552af9223d76a 100644 (file)
@@ -1039,6 +1039,7 @@ static void tb_service_release(struct device *dev)
        ida_free(&xd->service_ids, svc->id);
        kfree(svc->key);
        kfree(svc);
+       tb_xdomain_put(xd);
 }
 
 const struct device_type tb_service_type = {
@@ -1147,7 +1148,7 @@ static void enumerate_services(struct tb_xdomain *xd)
                svc->id = id;
                svc->dev.bus = &tb_bus_type;
                svc->dev.type = &tb_service_type;
-               svc->dev.parent = &xd->dev;
+               svc->dev.parent = get_device(&xd->dev);
                dev_set_name(&svc->dev, "%s.%d", dev_name(&xd->dev), svc->id);
 
                tb_service_debugfs_init(svc);