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>
This commit is contained in:
parent
3b710ec06e
commit
24988d3a25
|
@ -135,9 +135,12 @@ EXPORT_SYMBOL_GPL(gb_hd_add);
|
||||||
|
|
||||||
void gb_hd_del(struct gb_host_device *hd)
|
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_svc_del(hd->svc);
|
||||||
|
gb_interfaces_remove(hd);
|
||||||
|
|
||||||
device_del(&hd->dev);
|
device_del(&hd->dev);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue