[PATCH] USB:serial: fix deadlock caused by reseting device in .close

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

 



From: Ming Lei <tom.leiming@xxxxxxxxx>

The deadlock is caused by mutex_lock(&port->serial->disc_mutex)
(called in garmin_close() and usb_serial_disconnect() ). The garmin
usb_driver doesn't define .pre_reset and .post_reset, so
usb_reset_devie() will unbound garmin usb_driver before doing bus
reset, which makes .disconnect() called, then deadlock happens.

This patch defines .pre_reset and .post_reset in garmin usb_driver
to prevent the usb driver from being unbound in usb_reset_device()
called by garmin_close.

This patch fixes the bug reported in the link:
	http://bugs.archlinux.org/task/12079

Signed-off-by: Ming Lei <tom.leiming@xxxxxxxxx>
Reported-by:Hal Murray <hmurray@xxxxxxxxxxxxxxx>
Tested-by:Hal Murray <hmurray@xxxxxxxxxxxxxxx>
---
 drivers/usb/serial/garmin_gps.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/serial/garmin_gps.c b/drivers/usb/serial/garmin_gps.c
index a26a0e2..8c8b716 100644
--- a/drivers/usb/serial/garmin_gps.c
+++ b/drivers/usb/serial/garmin_gps.c
@@ -224,10 +224,22 @@ static struct usb_device_id id_table [] = {
 
 MODULE_DEVICE_TABLE(usb, id_table);
 
+static int  garmin_pre_reset(struct usb_interface *intf)
+{
+	return 0;
+}
+
+static int  garmin_post_reset(struct usb_interface *intf)
+{
+	return 0;
+}
+
 static struct usb_driver garmin_driver = {
 	.name =		"garmin_gps",
 	.probe =	usb_serial_probe,
 	.disconnect =	usb_serial_disconnect,
+	.pre_reset   =   garmin_pre_reset,
+	.post_reset  =   garmin_post_reset,
 	.id_table =	id_table,
 	.no_dynamic_id = 1,
 };
-- 
1.6.0.GIT

--
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