Commit 48d7077c authored by Johan Hovold's avatar Johan Hovold Committed by Greg Kroah-Hartman

greybus: bundle: fix sleep-while-atomic in gb_bundle_destroy

Make sure to release the spin lock protecting the interface bundle lists
before tearing down the connections and removing the bundle device,
which are operations that may sleep.
Signed-off-by: default avatarJohan Hovold <johan@hovoldconsulting.com>
Reviewed-by: default avatarAlex Elder <elder@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent 067f3b6b
......@@ -126,6 +126,7 @@ struct gb_bundle *gb_bundle_create(struct gb_interface *intf, u8 interface_id)
*/
void gb_bundle_destroy(struct gb_interface *intf)
{
LIST_HEAD(list);
struct gb_bundle *bundle;
struct gb_bundle *temp;
......@@ -133,12 +134,14 @@ void gb_bundle_destroy(struct gb_interface *intf)
return;
spin_lock_irq(&gb_bundles_lock);
list_for_each_entry_safe(bundle, temp, &intf->bundles, links) {
list_splice_init(&intf->bundles, &list);
spin_unlock_irq(&gb_bundles_lock);
list_for_each_entry_safe(bundle, temp, &list, links) {
list_del(&bundle->links);
gb_bundle_connections_exit(bundle);
device_del(&bundle->dev);
}
spin_unlock_irq(&gb_bundles_lock);
}
int gb_bundle_init(struct gb_interface *intf, u8 bundle_id, u8 device_id)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment