summaryrefslogtreecommitdiffstats
path: root/drivers/staging/greybus/hd.c
diff options
context:
space:
mode:
authorJohan Hovold <johan@hovoldconsulting.com>2016-01-28 12:43:29 +0100
committerGreg Kroah-Hartman <gregkh@google.com>2016-01-28 08:10:56 -0800
commit24988d3a253303be63c460071dd99bd4674c0880 (patch)
tree2ca15cee5451f300e3c6801dd522ded8c883ddf5 /drivers/staging/greybus/hd.c
parent3b710ec06e00ce041606678b25f9c82e95fde813 (diff)
downloadop-kernel-dev-24988d3a253303be63c460071dd99bd4674c0880.zip
op-kernel-dev-24988d3a253303be63c460071dd99bd4674c0880.tar.gz
greybus: hd: fix host-device-removal race
Make sure to tear down the svc and flush any on-going hotplug processing before removing the remaining interfaces. This fixes crashes due to host-device removal racing with svc hotplug/unplug processing (e.g. at "UniPro restart"). Testing Done: Verified that this fixes crashes reproducible on SDB when unloading the host-device driver module while generating hotplug/unplug events. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/hd.c')
-rw-r--r--drivers/staging/greybus/hd.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/staging/greybus/hd.c b/drivers/staging/greybus/hd.c
index b11a636..d1aab29 100644
--- a/drivers/staging/greybus/hd.c
+++ b/drivers/staging/greybus/hd.c
@@ -135,9 +135,12 @@ EXPORT_SYMBOL_GPL(gb_hd_add);
void gb_hd_del(struct gb_host_device *hd)
{
- gb_interfaces_remove(hd);
-
+ /*
+ * Tear down the svc and flush any on-going hotplug processing before
+ * removing the remaining interfaces.
+ */
gb_svc_del(hd->svc);
+ gb_interfaces_remove(hd);
device_del(&hd->dev);
}
OpenPOWER on IntegriCloud