diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-10-18 11:52:33 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-10-18 11:52:33 -0700 |
commit | ec83e4c9affbc8ee0632766dbb0bfef2938f7e54 (patch) | |
tree | af47685c554cf4aa73c0cf609da2dd9850a7af19 /drivers/usb | |
parent | 7a759197974894213621aa65f0571b51904733d6 (diff) | |
parent | bc25770f00d3f4e7482278f9823c2c2793605484 (diff) | |
download | linux-stable-ec83e4c9affbc8ee0632766dbb0bfef2938f7e54.tar.gz linux-stable-ec83e4c9affbc8ee0632766dbb0bfef2938f7e54.tar.bz2 linux-stable-ec83e4c9affbc8ee0632766dbb0bfef2938f7e54.zip |
Merge tag 'usb-serial-5.4-rc4' of https://git.kernel.org/pub/scm/linux/kernel/git/johan/usb-serial into usb-linus
Johan writes:
USB-serial fixes for 5.4-rc4
Here's a fix for a long-standing locking bug in ti_usb_3410_5052 and
related clean up.
Both have been in linux-next with no reported issues.
Signed-off-by: Johan Hovold <johan@kernel.org>
* tag 'usb-serial-5.4-rc4' of https://git.kernel.org/pub/scm/linux/kernel/git/johan/usb-serial:
USB: serial: ti_usb_3410_5052: clean up serial data access
USB: serial: ti_usb_3410_5052: fix port-close races
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/serial/ti_usb_3410_5052.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c index dd0ad67aa71e..ef23acc9b9ce 100644 --- a/drivers/usb/serial/ti_usb_3410_5052.c +++ b/drivers/usb/serial/ti_usb_3410_5052.c @@ -776,7 +776,6 @@ static void ti_close(struct usb_serial_port *port) struct ti_port *tport; int port_number; int status; - int do_unlock; unsigned long flags; tdev = usb_get_serial_data(port->serial); @@ -800,16 +799,13 @@ static void ti_close(struct usb_serial_port *port) "%s - cannot send close port command, %d\n" , __func__, status); - /* if mutex_lock is interrupted, continue anyway */ - do_unlock = !mutex_lock_interruptible(&tdev->td_open_close_lock); - --tport->tp_tdev->td_open_port_count; - if (tport->tp_tdev->td_open_port_count <= 0) { + mutex_lock(&tdev->td_open_close_lock); + --tdev->td_open_port_count; + if (tdev->td_open_port_count == 0) { /* last port is closed, shut down interrupt urb */ usb_kill_urb(port->serial->port[0]->interrupt_in_urb); - tport->tp_tdev->td_open_port_count = 0; } - if (do_unlock) - mutex_unlock(&tdev->td_open_close_lock); + mutex_unlock(&tdev->td_open_close_lock); } |