Commit graph

2815 commits

Author SHA1 Message Date
Johan Hovold
6fdb7b0c0e USB: serial: ark3116: use port device for info and error messages
Use the port device rather than usb device in info and error messages.

This makes sure that driver and tty port is included in the messages,
while also making them more uniform.

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-01-31 17:21:38 +01:00
Johan Hovold
41a2af93ae USB: serial: ark3116: remove redundant interrupt-urb check
Remove redundant check of num_interrupt_in which has already been
verified in probe (killing a NULL-urb would also have been fine).

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-01-31 17:21:29 +01:00
Johan Hovold
4481200364 USB: serial: ark3116: fix endpoint-check return value
Return -ENODEV rather than -EINVAL on probe errors due to a missing
endpoint.

Also clean up the endpoint sanity check somewhat and use the interface
device for logging a more compact error in case an expected endpoint is
missing.

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-01-31 17:20:37 +01:00
Maksim Salau
ea534e0b40 USB: serial: add uPD78F0730 USB to Serial Adaptor Driver
The adaptor can be found on development boards for 78k, RL78 and V850
microcontrollers produced by Renesas Electronics Corporation.

This is not a full-featured USB to serial converter, however it allows
basic communication and simple control which is enough for programming of
on-board flash and debugging through a debug monitor.

uPD78F0730 is a USB-enabled microcontroller with USB-to-UART conversion
implemented in firmware.

This chip is also present in some debugging adaptors which use it for
USB-to-SPI conversion as well. The present driver doesn't cover SPI,
only USB-to-UART conversion is supported.

Signed-off-by: Maksim Salau <maksim.salau@gmail.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-01-26 10:18:17 +01:00
Johan Hovold
51211a3d9b USB: serial: drop unused ASYNC flags
Do not report ASYNC_SKIP_TEST or ASYNC_AUTO_IRQ as being set in
TIOCGSERIAL handlers as these flags are not supported and do not really
make any sense for USB serial devices in the first place.

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-01-26 09:49:13 +01:00
Johan Hovold
5955660813 USB: serial: ftdi_sio: clean up ioctl handler
Clean up the ioctl handler and make sure to pass an unsigned-int rather
than serial_struct pointer to the TIOCSERGETLSR helper as this it what
the user argument really is.

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-01-26 09:48:43 +01:00
Johan Hovold
c6dce26266 USB: serial: ftdi_sio: fix extreme low-latency setting
Since commit 557aaa7ffa ("ft232: support the ASYNC_LOW_LATENCY
flag") the FTDI driver has been using a receive latency-timer value of
1 ms instead of the device default of 16 ms.

The latency timer is used to periodically empty a non-full receive
buffer, but a status header is always sent when the timer expires
including when the buffer is empty. This means that a two-byte bulk
message is received every millisecond also for an otherwise idle port as
long as it is open.

Let's restore the pre-2009 behaviour which reduces the rate of the
status messages to 1/16th (e.g. interrupt frequency drops from 1 kHz to
62.5 Hz) by not setting ASYNC_LOW_LATENCY by default.

Anyone willing to pay the price for the minimum-latency behaviour should
set the flag explicitly instead using the TIOCSSERIAL ioctl or a tool
such as setserial (e.g. setserial /dev/ttyUSB0 low_latency).

Note that since commit 0cbd81a9f6 ("USB: ftdi_sio: remove
tty->low_latency") the ASYNC_LOW_LATENCY flag has no other effects but
to set a minimal latency timer.

Reported-by: Antoine Aubert <a.aubert@overkiz.com>
Fixes: 557aaa7ffa ("ft232: support the ASYNC_LOW_LATENCY flag")
Cc: stable@vger.kernel.org # v2.6.31: e3e574ad85
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-01-25 16:50:58 +01:00
Johan Hovold
2eee05020a USB: serial: opticon: fix CTS retrieval at open
The opticon driver used a control request at open to trigger a CTS
status notification to be sent over the bulk-in pipe. When the driver
was converted to using the generic read implementation, an inverted test
prevented this request from being sent, something which could lead to
TIOCMGET reporting an incorrect CTS state.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Fixes: 7a6ee2b027 ("USB: opticon: switch to generic read
implementation")
Cc: stable <stable@vger.kernel.org>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-01-16 16:42:21 +01:00
Johan Hovold
39712e8bfa USB: serial: ti_usb_3410_5052: fix control-message error handling
Make sure to detect and return an error on zero-length control-message
transfers when reading from the device.

This addresses a potential failure to detect an empty transmit buffer
during close.

Also remove a redundant check for short transfer when sending a command.

Fixes: 1da177e4c3 ("Linux-2.6.12-rc2")
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-01-16 16:38:57 +01:00
Johan Hovold
1eac5c244f USB: serial: ssu100: fix control-message error handling
Make sure to detect short control-message transfers rather than continue
with zero-initialised data when retrieving modem status and during
device initialisation.

Fixes: 52af954599 ("USB: add USB serial ssu100 driver")
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-01-16 16:38:57 +01:00
Johan Hovold
5ed8d41023 USB: serial: spcp8x5: fix modem-status handling
Make sure to detect short control transfers and return zero on success
when retrieving the modem status.

This fixes the TIOCMGET implementation which since e1ed212d85 ("USB:
spcp8x5: add proper modem-status support") has returned TIOCM_LE on
successful retrieval, and avoids leaking bits from the stack on short
transfers.

This also fixes the carrier-detect implementation which since the above
mentioned commit unconditionally has returned true.

Fixes: e1ed212d85 ("USB: spcp8x5: add proper modem-status support")
Cc: stable <stable@vger.kernel.org>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-01-16 16:38:56 +01:00
Johan Hovold
8c34cb8ddf USB: serial: quatech2: fix control-message error handling
Make sure to detect short control-message transfers when fetching
modem and line state in open and when retrieving registers.

This specifically makes sure that an errno is returned to user space on
errors in TIOCMGET instead of a zero bitmask.

Also drop the unused getdevice function which also lacked appropriate
error handling.

Fixes: f7a33e608d ("USB: serial: add quatech2 usb to serial driver")
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-01-16 16:38:56 +01:00
Johan Hovold
b5fda434b1 USB: serial: pl2303: fix line-setting error handling
Make sure to return an error on zero-length transfers when retrieving
the line settings even if the driver currently ignores the return value.

Also remove a redundant check for short transfer when setting the line
settings.

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-01-16 16:38:56 +01:00
Johan Hovold
cd8db057e9 USB: serial: mos7840: fix control-message error handling
Make sure to detect short transfers when reading a device register.

The modem-status handling had sufficient error checks in place, but move
handling of short transfers into the register accessor function itself
for consistency.

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-01-16 16:38:56 +01:00
Johan Hovold
0d130367ab USB: serial: mos7720: fix control-message error handling
Make sure to log an error on short transfers when reading a device
register.

Also clear the provided buffer (which if often an uninitialised
automatic variable) on errors as the driver currently does not bother to
check for errors.

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-01-16 16:38:56 +01:00
Johan Hovold
36356a669e USB: serial: mct_u232: fix modem-status error handling
Make sure to detect short control-message transfers so that errors are
logged when reading the modem status at open.

Note that while this also avoids initialising the modem status using
uninitialised heap data, these bits could not leak to user space as they
are currently not used.

Fixes: 1da177e4c3 ("Linux-2.6.12-rc2")
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-01-16 16:38:56 +01:00
Johan Hovold
750acdd781 USB: serial: iuu_phoenix: remove unused buffer from open
Remove code that allocated but never used a buffer during open.

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-01-16 16:38:56 +01:00
Johan Hovold
3c0e25d883 USB: serial: io_edgeport: fix descriptor error handling
Make sure to detect short control-message transfers and log an error
when reading incomplete manufacturer and boot descriptors.

Note that the default all-zero descriptors will now be used after a
short transfer is detected instead of partially initialised ones.

Fixes: 1da177e4c3 ("Linux-2.6.12-rc2")
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-01-16 16:38:56 +01:00
Johan Hovold
e4457d9798 USB: serial: io_edgeport: fix epic-descriptor handling
Use a dedicated buffer for the DMA transfer and make sure to detect
short transfers to avoid parsing a corrupt descriptor.

Fixes: 6e8cf7751f ("USB: add EPIC support to the io_edgeport driver")
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-01-16 16:38:56 +01:00
Johan Hovold
e3e574ad85 USB: serial: ftdi_sio: fix latency-timer error handling
Make sure to detect short responses when reading the latency timer to
avoid using stale buffer data.

Note that no heap data would currently leak through sysfs as
ASYNC_LOW_LATENCY is set by default.

Fixes: 1da177e4c3 ("Linux-2.6.12-rc2")
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-01-16 16:38:55 +01:00
Johan Hovold
427c3a95e3 USB: serial: ftdi_sio: fix modem-status error handling
Make sure to detect short responses when fetching the modem status in
order to avoid parsing uninitialised buffer data and having bits of it
leak to user space.

Note that we still allow for short 1-byte responses.

Fixes: 1da177e4c3 ("Linux-2.6.12-rc2")
Cc: stable <stable@vger.kernel.org>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-01-16 16:38:55 +01:00
Johan Hovold
b631433b17 USB: serial: ark3116: fix open error handling
Fix open error handling which failed to detect errors when reading the
MSR and LSR registers, something which could lead to the shadow
registers being initialised from errnos.

Note that calling the generic close implementation is sufficient in the
error paths as the interrupt urb has not yet been submitted and the
register updates have not been made.

Fixes: f4c1e8d597 ("USB: ark3116: Make existing functions 16450-aware
and add close and release functions.")
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-01-16 16:38:55 +01:00
Johan Hovold
9fef37d7cf USB: serial: ark3116: fix register-accessor error handling
The current implementation failed to detect short transfers, something
which could lead to bits of the uninitialised heap transfer buffer
leaking to user space.

Fixes: 149fc791a4 ("USB: ark3116: Setup some basic infrastructure for
new ark3116 driver.")
Fixes: f4c1e8d597 ("USB: ark3116: Make existing functions 16450-aware
and add close and release functions.")
Cc: stable <stable@vger.kernel.org>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-01-16 16:38:55 +01:00
Johan Hovold
2c85e0a961 USB: serial: kl5kusb105: remove unused termios structure
Remove unused termios structure from private data that was left by an
earlier purge by commit b1cff285ae ("usb serial: Eliminate bogus ioctl
code").

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-01-16 13:00:22 +01:00
Johan Hovold
c2a24bb1e4 USB: serial: kl5kusb105: clean up struct definition
Drop redundant packed attribute from the port-settings struct which is
already 1-byte aligned. Also replace __u8 with u8 for the field types as
this is not a structure we share with user space.

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-01-16 13:00:15 +01:00
Johan Hovold
2d11f28207 USB: serial: kl5kusb105: remove dead code
Remove dead and broken code that only served as a reminder to one day
implement modem control.

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-01-16 13:00:04 +01:00
Johan Hovold
0546579330 USB: serial: kl5kusb105: make logging less verbose
Replace a couple of dev_info with dev_dbg and remove another.

Also use the port device for logging, and include a radix prefix when
logging the baudrate.

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-01-16 12:59:41 +01:00
Johan Hovold
7c61b0d5e8 USB: serial: ch341: change initial line-control settings
Some CH340 devices appear unable to change the initial LCR settings, so
set a sane 8N1 default during probe to enable basic support for such
devices.

Also drop a redundant LCR read during device initialisation.

Signed-off-by: Johan Hovold <johan@kernel.org>
2017-01-16 12:32:21 +01:00
Johan Hovold
448b6dc5a9 USB: serial: ch341: rename LCR variable in set_termios
Rename the line-control-register variable in set_termios to "lcr" and
use u8 type to match the shadow register.

Signed-off-by: Johan Hovold <johan@kernel.org>
2017-01-16 12:32:21 +01:00
Johan Hovold
e802446035 USB: serial: ch341: rename modem-status register
Rename the shadow modem-status register currently named "line_status" to
the less confusing "msr".

Also rename the helper function used to parse the interrupt data.

Signed-off-by: Johan Hovold <johan@kernel.org>
2017-01-16 12:32:20 +01:00
Johan Hovold
beea33d4f9 USB: serial: ch341: rename shadow modem-control register
Rename the shadow modem-control register currently named "line_control"
to the less confusing "mcr".

Signed-off-by: Johan Hovold <johan@kernel.org>
2017-01-16 12:32:20 +01:00
Johan Hovold
91e0efcd4c USB: serial: ch341: clean up control debug messages
Clean up the control-transfer debug messages by dropping redundant
information and unnecessary casts.

Signed-off-by: Johan Hovold <johan@kernel.org>
2017-01-16 12:31:56 +01:00
Johan Hovold
a0467a967f USB: serial: ch341: fix modem-status handling
The modem-status register was read as part of device configuration at
port_probe and then again at open (and reset-resume). During open (and
reset-resume) the MSR was read before submitting the interrupt URB,
something which could lead to an MSR-change going unnoticed when it
races with open (reset-resume).

Fix this by dropping the redundant reconfiguration of the port at every
open, and only read the MSR after the interrupt URB has been submitted.

Fixes: 664d5df92e ("USB: usb-serial ch341: support for DTR/RTS/CTS")
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-01-16 12:30:45 +01:00
Sudip Mukherjee
56e6d90797 USB: serial: cypress_m8: remove unused variable
The variable havedata was only being set but never used afterwards.

Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-01-16 12:26:58 +01:00
Johan Hovold
2d5a9c72d0 USB: serial: ch341: fix control-message error handling
A short control transfer would currently fail to be detected, something
which could lead to stale buffer data being used as valid input.

Check for short transfers, and make sure to log any transfer errors.

Note that this also avoids leaking heap data to user space (TIOCMGET)
and the remote device (break control).

Fixes: 6ce7610478 ("USB: Driver for CH341 USB-serial adaptor")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-01-11 12:08:57 +01:00
Johan Hovold
146cc8a17a USB: serial: kl5kusb105: fix line-state error handling
The current implementation failed to detect short transfers when
attempting to read the line state, and also, to make things worse,
logged the content of the uninitialised heap transfer buffer.

Fixes: abf492e7b3 ("USB: kl5kusb105: fix DMA buffers on stack")
Fixes: 1da177e4c3 ("Linux-2.6.12-rc2")
Cc: stable <stable@vger.kernel.org>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-01-10 16:42:26 +01:00
Johan Hovold
55fa15b598 USB: serial: ch341: fix baud rate and line-control handling
Revert to using direct register writes to set the divisor and
line-control registers.

A recent change switched to using the init vendor command to update
these registers, something which also enabled support for CH341A
devices. It turns out that simply setting bit 7 in the divisor register
is sufficient to support CH341A and specifically prevent data from being
buffered until a full endpoint-size packet (32 bytes) has been received.

Using the init command also had the side-effect of temporarily
deasserting the DTR/RTS signals on every termios change (including
initialisation on open) something which for example could cause problems
in setups where DTR is used to trigger a reset.

Fixes: 4e46c410e0 ("USB: serial: ch341: reinitialize chip on
reconfiguration")
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-01-09 14:55:40 +01:00
Johan Hovold
3cca8624b6 USB: serial: ch341: fix line settings after reset-resume
A recent change added support for modifying the default line-control
settings, but did not make sure that the modified settings were used as
part of reconfiguration after a device has been reset during resume.

This caused a port that was open before suspend to be unusable until
being closed and reopened.

Fixes: ba781bdf86 ("USB: serial: ch341: add support for parity, frame
length, stop bits")
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-01-09 14:55:39 +01:00
Johan Hovold
ce5e292828 USB: serial: ch341: fix resume after reset
Fix reset-resume handling which failed to resubmit the read and
interrupt URBs, thereby leaving a port that was open before suspend in a
broken state until closed and reopened.

Fixes: 1ded7ea47b ("USB: ch341 serial: fix port number changed after
resume")
Fixes: 2bfd1c96a9 ("USB: serial: ch341: remove reset_resume callback")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-01-09 14:55:38 +01:00
Johan Hovold
f2950b7854 USB: serial: ch341: fix open error handling
Make sure to stop the interrupt URB before returning on errors during
open.

Fixes: 664d5df92e ("USB: usb-serial ch341: support for DTR/RTS/CTS")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-01-09 14:55:38 +01:00
Johan Hovold
030ee7ae52 USB: serial: ch341: fix modem-control and B0 handling
The modem-control signals are managed by the tty-layer during open and
should not be asserted prematurely when set_termios is called from
driver open.

Also make sure that the signals are asserted only when changing speed
from B0.

Fixes: 664d5df92e ("USB: usb-serial ch341: support for DTR/RTS/CTS")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-01-09 14:55:37 +01:00
Johan Hovold
a20047f36e USB: serial: ch341: fix open and resume after B0
The private baud_rate variable is used to configure the port at open and
reset-resume and must never be set to (and left at) zero or reset-resume
and all further open attempts will fail.

Fixes: aa91def41a ("USB: ch341: set tty baud speed according to tty
struct")
Fixes: 664d5df92e ("USB: usb-serial ch341: support for DTR/RTS/CTS")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-01-09 14:55:37 +01:00
Johan Hovold
4e2da44691 USB: serial: ch341: fix initial modem-control state
DTR and RTS will be asserted by the tty-layer when the port is opened
and deasserted on close (if HUPCL is set). Make sure the initial state
is not-asserted before the port is first opened as well.

Fixes: 664d5df92e ("USB: usb-serial ch341: support for DTR/RTS/CTS")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-01-09 14:55:37 +01:00
Johan Hovold
ef079936d3 USB: serial: ti_usb_3410_5052: fix NULL-deref at open
Fix NULL-pointer dereference in open() should a malicious device lack
the expected endpoints:

Unable to handle kernel NULL pointer dereference at virtual address 00000030
..
[<bf06a6b0>] (ti_open [ti_usb_3410_5052]) from [<bf02e118>] (serial_port_activate+0x68/0x98 [usbserial])

Fixes: 1da177e4c3 ("Linux-2.6.12-rc2")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-01-04 10:43:57 +01:00
Johan Hovold
cc09092482 USB: serial: spcp8x5: fix NULL-deref at open
Fix NULL-pointer dereference in open() should the device lack the
expected endpoints:

Unable to handle kernel NULL pointer dereference at virtual address 00000030
...
PC is at spcp8x5_open+0x30/0xd0 [spcp8x5]

Fixes: 619a6f1d14 ("USB: add usb-serial spcp8x5 driver")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-01-04 10:43:57 +01:00
Johan Hovold
f09d1886a4 USB: serial: quatech2: fix sleep-while-atomic in close
The write URB was being killed using the synchronous interface while
holding a spin lock in close().

Simply drop the lock and busy-flag update, something which would have
been taken care of by the completion handler if the URB was in flight.

Fixes: f7a33e608d ("USB: serial: add quatech2 usb to serial driver")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-01-04 10:43:56 +01:00
Johan Hovold
76ab439ed1 USB: serial: pl2303: fix NULL-deref at open
Fix NULL-pointer dereference in open() should a type-0 or type-1 device
lack the expected endpoints:

Unable to handle kernel NULL pointer dereference at virtual address 00000030
...
PC is at pl2303_open+0x38/0xec [pl2303]

Note that a missing interrupt-in endpoint would have caused open() to
fail.

Fixes: 1da177e4c3 ("Linux-2.6.12-rc2")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-01-04 10:43:56 +01:00
Johan Hovold
5afeef2366 USB: serial: oti6858: fix NULL-deref at open
Fix NULL-pointer dereference in open() should the device lack the
expected endpoints:

Unable to handle kernel NULL pointer dereference at virtual address 00000030
...
PC is at oti6858_open+0x30/0x1d0 [oti6858]

Note that a missing interrupt-in endpoint would have caused open() to
fail.

Fixes: 49cdee0ed0 ("USB: oti6858 usb-serial driver (in Nokia CA-42
cable)")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-01-04 10:43:48 +01:00
Johan Hovold
a5bc01949e USB: serial: omninet: fix NULL-derefs at open and disconnect
Fix NULL-pointer dereferences at open() and disconnect() should the
device lack the expected bulk-out endpoints:

Unable to handle kernel NULL pointer dereference at virtual address 000000b4
...
[c0170ff0>] (__lock_acquire) from [<c0172f00>] (lock_acquire+0x108/0x264)
[<c0172f00>] (lock_acquire) from [<c06a5090>] (_raw_spin_lock_irqsave+0x58/0x6c)
[<c06a5090>] (_raw_spin_lock_irqsave) from [<c0470684>] (tty_port_tty_set+0x28/0xa4)
[<c0470684>] (tty_port_tty_set) from [<bf08d384>] (omninet_open+0x30/0x40 [omninet])
[<bf08d384>] (omninet_open [omninet]) from [<bf07c118>] (serial_port_activate+0x68/0x98 [usbserial])

Unable to handle kernel NULL pointer dereference at virtual address 00000234
...
[<bf01f418>] (omninet_disconnect [omninet]) from [<bf0016c0>] (usb_serial_disconnect+0xe4/0x100 [usbserial])

Fixes: 1da177e4c3 ("Linux-2.6.12-rc2")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-01-04 10:37:21 +01:00
Johan Hovold
472d7e55d5 USB: serial: mos7840: fix misleading interrupt-URB comment
The interrupt URB is killed at final port close since commit
0de9a7024e ("USB: overhaul of mos7840 driver").

Fixes: 0de9a7024e ("USB: overhaul of mos7840 driver")
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-01-04 10:37:21 +01:00