[RFC]cdc-wdm: bug in ceasing IO

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>From c37d436b8832e817ab437baa3324f6c08c846af9 Mon Sep 17 00:00:00 2001
From: Oliver Neukum <oneukum@xxxxxxx>
Date: Fri, 16 Jan 2015 15:13:28 +0100
Subject: [PATCH] cdc-wdm: bug in ceasing IO

The work submits the URB and the URB queues the work.
To reliably kill this cycle a flag needs to be set
and one of the kills repeated.

Signed-off-by: Oliver Neukum <oneukum@xxxxxxx>
---
 drivers/usb/class/cdc-wdm.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c
index 5ff7018..e24bad6 100644
--- a/drivers/usb/class/cdc-wdm.c
+++ b/drivers/usb/class/cdc-wdm.c
@@ -976,8 +976,10 @@ static void wdm_disconnect(struct usb_interface *intf)
 	wake_up_all(&desc->wait);
 	mutex_lock(&desc->rlock);
 	mutex_lock(&desc->wlock);
+	/* circular dependency. The second kill is needed */
 	kill_urbs(desc);
 	cancel_work_sync(&desc->rxwork);
+	kill_urbs(desc);
 	mutex_unlock(&desc->wlock);
 	mutex_unlock(&desc->rlock);
 
@@ -1017,9 +1019,10 @@ static int wdm_suspend(struct usb_interface *intf, pm_message_t message)
 
 		set_bit(WDM_SUSPENDING, &desc->flags);
 		spin_unlock_irq(&desc->iuspin);
-		/* callback submits work - order is essential */
+		/* circular dependency. The second kill is needed */
 		kill_urbs(desc);
 		cancel_work_sync(&desc->rxwork);
+		kill_urbs(desc);
 	}
 	if (!PMSG_IS_AUTO(message)) {
 		mutex_unlock(&desc->wlock);
@@ -1077,8 +1080,10 @@ static int wdm_pre_reset(struct usb_interface *intf)
 	wake_up_all(&desc->wait);
 	mutex_lock(&desc->rlock);
 	mutex_lock(&desc->wlock);
+	/* circular dependency. The second kill is needed */
 	kill_urbs(desc);
 	cancel_work_sync(&desc->rxwork);
+	kill_urbs(desc);
 	return 0;
 }
 
-- 
1.8.4.5




--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux