fix oops in usbserial_cleanup function;
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 6 lines · marui
1. I find this bug on OpenSUSE 11.3 which kernel vesion is 2.6.34, but the latest kernel vesion 2.6.36-rc7 aslo have this bug. This patch is based on the kernel of 2.6.36-rc7.
2. Bug report:
a. Install huawei datacard dashboard on OpenSUSE 11.3
b. Plug in huawei datacard into OpenSUSE 11.3 which kernel verison is 2.6.36-rc7
c. After the dashboard has detected the device, I pull out the usb datacard
d. close datashboard,then kernel panic will happen inusbserial_cleanupfunction.
What does the "dashboard" program do? Hold the port open?
Quoted 9 lines
3. fix the bug:
I findusbserial_cleanupshould judge the usb device wheher has been disconnected firtly.diff -uprN -X linux-2.6.36-rc7-orig/Documentation/dontdiff
linux-2.6.36-rc7-orig/drivers/usb/serial/usb-serial.clinux-2.6.36-rc7/drivers/usb/serial/usb-serial.c
drivers/usb/serial/usb-serial.c 2010-10-14 20:59:47.000000000 -0400 static void serial_cleanup(struct tty_st · line 335
Quoted 8 lines
drivers/usb/serial/usb-serial.c 2010-10-14 20:59:47.000000000 -0400 renamed from drivers/usb/serial/usb-serial.c 2010-10-06 16:39:52.000000000 -0400 +5
-0@@ -328,6 +328,20 @@ static void serial_cleanup(struct tty_st /* The console is magical. Do not hang up the console hardware * or there will be tears. */ + dbg("%s start\n",__func__); + if(NULL == port) + { + dbg("%s NULL == port\n",__func__); + return;
We don't need to keep the dbg statements here, do we?
drivers/usb/serial/usb-serial.c 2010-10-14 20:59:47.000000000 -0400 static void serial_cleanup(struct tty_st · line 342
Quoted 7 lines
drivers/usb/serial/usb-serial.c 2010-10-14 20:59:47.000000000 -0400 renamed from drivers/usb/serial/usb-serial.c 2010-10-06 16:39:52.000000000 -0400 +7
-0+ } + mutex_lock(&port->serial->disc_mutex); + if (port->serial->disconnected) + { + dbg("%s port->serial->disconnected\n",__func__); + return_serial(port->serial); + return;
You can't return with a lock held.
drivers/usb/serial/usb-serial.c 2010-10-14 20:59:47.000000000 -0400 static void serial_cleanup(struct tty_st · line 346
Quoted 4 lines
drivers/usb/serial/usb-serial.c 2010-10-14 20:59:47.000000000 -0400 renamed from drivers/usb/serial/usb-serial.c 2010-10-06 16:39:52.000000000 -0400 +2
-0+ } + mutex_unlock(&port->serial->disc_mutex); if (port->port.console) return;
Your tabs and spaces got all mixed up, and it can't be applied. Also, I need a "Signed-off-by:" line to be able to accept it. Care to read the file Documentation/SubmittingPatches for how to format a patch so we can take it?
Also, run the patch through scripts/checkpatch.pl and resolve the coding style issues before resending please.
thanks,
greg k-h