[azure 4.13][PATCH 14/19] UBUNTU: SAUCE: vmbus: unregister device_obj->channels_kset

Marcelo Henrique Cerri marcelo.cerri at canonical.com
Tue Dec 12 15:42:03 UTC 2017

From: Dexuan Cui <decui at microsoft.com>

BugLink: http://bugs.launchpad.net/bugs/1736283

Fixes: c2e5df616e1a ("vmbus: add per-channel sysfs info")

Without the patch, a device can't be thoroughly destroyed, because
vmbus_device_register() -> kset_create_and_add() still holds a reference
to the hv_device's device.kobj.

Signed-off-by: Dexuan Cui <decui at microsoft.com>
Cc: Stephen Hemminger <sthemmin at microsoft.com>
Cc: K. Y. Srinivasan <kys at microsoft.com>

The patch is from https://patchwork.kernel.org/patch/10055079/, and
hasn't been in any upstream repo as of Dec 04, 2017.
Signed-off-by: Dexuan Cui <decui at microsoft.com>

Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri at canonical.com>
 drivers/hv/vmbus_drv.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index 47b666dcfbb6..29f2e9ca3779 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -1381,6 +1381,8 @@ void vmbus_device_unregister(struct hv_device *device_obj)
 	pr_debug("child device %s unregistered\n",
+	kset_unregister(device_obj->channels_kset);
 	 * Kick off the process of unregistering the device.
 	 * This will call vmbus_remove() and eventually vmbus_device_release()

More information about the kernel-team mailing list