linux_old1/drivers/usb/serial
Simon Arlott 876ae50d94 USB: ftdi_sio: fix race condition in TIOCMIWAIT, and abort of TIOCMIWAIT when the device is removed
There are two issues here, one is that the device is generating
spurious very fast modem status line changes somewhere:

CTS becomes high then low 18µs later:
[121226.924373] ftdi_process_packet: prev rng=0 dsr=10 dcd=0 cts=6
[121226.924378] ftdi_process_packet: status=10 prev=00 diff=10
[121226.924382] ftdi_process_packet: now rng=0 dsr=10 dcd=0 cts=7
(wake_up_interruptible is called)
[121226.924391] ftdi_process_packet: prev rng=0 dsr=10 dcd=0 cts=7
[121226.924394] ftdi_process_packet: status=00 prev=10 diff=10
[121226.924397] ftdi_process_packet: now rng=0 dsr=10 dcd=0 cts=8
(wake_up_interruptible is called)

This wakes up the task in TIOCMIWAIT:
[121226.924405] ftdi_ioctl: 19451 rng=0->0 dsr=10->10 dcd=0->0 cts=6->8
(wait from 20:51:46 returns and observes both changes)

Which then calls TIOCMIWAIT again:
20:51:46.400239 ioctl(3, TIOCMIWAIT, 0x20) = 0
22:11:09.441818 ioctl(3, TIOCMGET, [TIOCM_DTR|TIOCM_RTS]) = 0
22:11:09.442812 ioctl(3, TIOCMIWAIT, 0x20) = -1 EIO (Input/output error)
(the second wake_up_interruptible takes effect and an I/O error occurs)

The other issue is that TIOCMIWAIT will wait forever (unless the task is
interrupted) if the device is removed.

This change removes the -EIO return that occurs if the counts don't
appear to have changed. Multiple counts may have been processed as
one or the waiting task may have started waiting after recording the
current count.

It adds a bool to indicate that the device has been removed so that
TIOCMIWAIT doesn't wait forever, and wakes up any tasks so that they can
return -EIO.

Signed-off-by: Simon Arlott <simon@fire.lp0.eu>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-04-09 15:41:40 -07:00
..
Kconfig USB: serial: metro-usb: add to the build 2012-03-08 13:34:01 -08:00
Makefile USB: serial: metro-usb: add to the build 2012-03-08 13:34:01 -08:00
Makefile-keyspan_pda_fw
aircable.c USB: serial: aircable.c: use module_usb_serial_driver 2012-02-28 13:11:32 -08:00
ark3116.c USB: serial: ark3116.c: use module_usb_serial_driver 2012-02-28 13:11:35 -08:00
belkin_sa.c USB: serial: belkin_sa.c: use module_usb_serial_driver 2012-02-28 13:11:35 -08:00
belkin_sa.h USB: belkin_sa.h: checkpatch cleanups 2010-05-20 13:21:46 -07:00
bus.c USB: fix bug in serial driver unregistration 2012-04-09 15:36:20 -07:00
ch341.c USB: serial: ch341.c: use module_usb_serial_driver 2012-02-28 13:11:37 -08:00
console.c usb-console: pass baud from console to the initial tty open 2010-05-20 13:21:32 -07:00
cp210x.c usb: cp210x: Update to support CP2105 and multiple interface devices 2012-03-02 16:19:16 -08:00
cyberjack.c USB: serial: cyberjack.c: use module_usb_serial_driver 2012-02-28 13:11:40 -08:00
cypress_m8.c USB: serial: cypress_m8.c: use module_usb_serial_driver 2012-02-28 13:11:41 -08:00
cypress_m8.h USB: cypress_m8.h: checkpatch cleanups 2010-05-20 13:21:46 -07:00
digi_acceleport.c USB: serial: digi_acceleport.c: use module_usb_serial_driver 2012-02-28 13:11:41 -08:00
empeg.c USB: serial: empeg.c: use module_usb_serial_driver 2012-02-28 13:11:42 -08:00
ezusb.c
ezusb_convert.pl
f81232.c USB: serial: add Fintek F81232 usb to serial driver 2012-02-28 13:36:35 -08:00
ftdi_sio.c USB: ftdi_sio: fix race condition in TIOCMIWAIT, and abort of TIOCMIWAIT when the device is removed 2012-04-09 15:41:40 -07:00
ftdi_sio.h USB: ftdi_sio: add support for FT-X series devices 2012-03-14 15:43:05 -07:00
ftdi_sio_ids.h USB: ftdi_sio: new PID: LUMEL PD12 2012-03-15 12:34:30 -07:00
funsoft.c USB: serial: funsoft.c: use module_usb_serial_driver 2012-02-28 13:11:44 -08:00
garmin_gps.c USB: serial: garmin_gps.c: use module_usb_serial_driver 2012-02-28 13:11:46 -08:00
generic.c usb-serial: new API for driver registration 2012-02-24 12:39:17 -08:00
hp4x.c USB: serial: hp4x.c: use module_usb_serial_driver 2012-02-28 13:11:49 -08:00
io_16654.h
io_edgeport.c USB: serial: io_edgeport.c: use module_usb_serial_driver 2012-02-28 13:11:51 -08:00
io_edgeport.h Fix common misspellings 2011-03-31 11:26:23 -03:00
io_ionsp.h USB: io_edgeport: checkpatch cleanups 2010-05-20 13:21:47 -07:00
io_tables.h usb-serial: use new registration API in [i-j]* drivers 2012-02-24 12:39:18 -08:00
io_ti.c USB: serial: io_ti.c: use module_usb_serial_driver 2012-02-28 13:11:53 -08:00
io_ti.h USB: io_edgeport: checkpatch cleanups 2010-05-20 13:21:47 -07:00
io_usbvend.h USB: io_edgeport: checkpatch cleanups 2010-05-20 13:21:47 -07:00
ipaq.c usb-serial: use new registration API in [i-j]* drivers 2012-02-24 12:39:18 -08:00
ipw.c USB: serial: ipw.c: use module_usb_serial_driver 2012-02-28 13:11:56 -08:00
ir-usb.c usb-serial: use new registration API in [i-j]* drivers 2012-02-24 12:39:18 -08:00
iuu_phoenix.c USB: serial: iuu_phoenix.c: use module_usb_serial_driver 2012-02-28 13:11:58 -08:00
iuu_phoenix.h
keyspan.c USB: serial: keyspan.c: use module_usb_serial_driver 2012-02-28 13:11:59 -08:00
keyspan.h usb-serial: use new registration API in [k-m]* drivers 2012-02-24 12:39:19 -08:00
keyspan_pda.c USB: serial: keyspan_pda.c: use module_usb_serial_driver 2012-02-28 13:11:59 -08:00
keyspan_usa26msg.h
keyspan_usa28msg.h
keyspan_usa49msg.h
keyspan_usa67msg.h
keyspan_usa90msg.h
kl5kusb105.c USB: serial: kl5kusb105.c: use module_usb_serial_driver 2012-02-28 13:12:00 -08:00
kl5kusb105.h USB: kl5kusb105.h: checkpatch cleanups 2010-05-20 13:21:47 -07:00
kobil_sct.c USB: serial: kobil_sct.c: use module_usb_serial_driver 2012-02-28 13:12:02 -08:00
kobil_sct.h USB: kobil_sct.h: checkpatch cleanups 2010-05-20 13:21:47 -07:00
mct_u232.c USB: serial: mct_u232.c: use module_usb_serial_driver 2012-02-28 13:12:05 -08:00
mct_u232.h Update broken web addresses in the kernel. 2010-10-18 11:03:14 +02:00
metro-usb.c USB: serial: metro-usb: Fix idProduct for Uni-Directional mode. 2012-04-09 15:36:20 -07:00
mos7720.c USB: serial: mos7720.c: use module_usb_serial_driver 2012-02-28 13:12:07 -08:00
mos7840.c USB: serial: mos7840: Fixed MCS7820 device attach problem 2012-03-14 12:25:26 -07:00
moto_modem.c USB: serial: moto_modem.c: use module_usb_serial_driver 2012-02-28 13:12:12 -08:00
navman.c USB: serial: navman.c: use module_usb_serial_driver 2012-02-28 13:12:14 -08:00
omninet.c USB: serial: omninet.c: use module_usb_serial_driver 2012-02-28 13:12:17 -08:00
opticon.c USB: serial: opticon.c: use module_usb_serial_driver 2012-02-28 13:12:19 -08:00
option.c USB: option: re-add NOVATELWIRELESS_PRODUCT_HSPA_HIGHSPEED to option_id array 2012-04-09 15:36:20 -07:00
oti6858.c USB: serial: oti6858.c: use module_usb_serial_driver 2012-02-28 13:12:22 -08:00
oti6858.h
pl2303.c USB: pl2303: fix DTR/RTS being raised on baud rate change 2012-04-09 15:36:20 -07:00
pl2303.h USB: serial: pl2303: rm duplicate id 2011-11-15 10:06:15 -08:00
qcaux.c USB: serial: qcaux.c: use module_usb_serial_driver 2012-02-28 13:12:24 -08:00
qcserial.c USB: serial: qcserial.c: use module_usb_serial_driver 2012-02-28 13:12:26 -08:00
safe_serial.c usb-serial: use new registration API in [q-s]* drivers 2012-02-24 12:39:20 -08:00
siemens_mpi.c USB: serial: siemens_mpi.c: use module_usb_serial_driver 2012-02-28 13:12:29 -08:00
sierra.c USB: serial: sierra.c: use module_usb_serial_driver 2012-02-28 13:12:31 -08:00
spcp8x5.c USB: serial: spcp8x5.c: use module_usb_serial_driver 2012-02-28 13:12:34 -08:00
ssu100.c USB: serial: ssu100.c: use module_usb_serial_driver 2012-02-28 13:12:36 -08:00
symbolserial.c USB: serial: symbolserial.c: use module_usb_serial_driver 2012-02-28 13:12:38 -08:00
ti_usb_3410_5052.c usb-serial: use new registration API in [t-z]* drivers 2012-02-24 12:39:21 -08:00
ti_usb_3410_5052.h USB: Serial: ti_usb_3410_5052: Add Abbot Diabetes Care cable id 2012-02-21 16:29:15 -08:00
usb-serial.c USB: fix bug in serial driver unregistration 2012-04-09 15:36:20 -07:00
usb-wwan.h tty: remove filp from the USB tty ioctls 2011-02-17 11:59:14 -08:00
usb_debug.c USB: serial: usb_debug.c: use module_usb_serial_driver 2012-02-28 13:12:41 -08:00
usb_wwan.c module_param: make bool parameters really bool (drivers & misc) 2012-01-13 09:32:20 +10:30
visor.c usb-serial: use new registration API in [t-z]* drivers 2012-02-24 12:39:21 -08:00
visor.h USB: visor.h: checkpatch cleanups 2010-05-20 13:21:47 -07:00
vivopay-serial.c USB: serial: vivopay-serial.c: use module_usb_serial_driver 2012-02-28 13:12:43 -08:00
whiteheat.c USB: serial: whiteheat.c: use module_usb_serial_driver 2012-02-28 13:12:44 -08:00
whiteheat.h
zio.c USB: serial: zio.c: use module_usb_serial_driver 2012-02-28 13:12:46 -08:00