1
0
Fork 0
Commit Graph

2772 Commits (932790109f62aa52bdb4bb62aa66653c0b51bc75)

Author SHA1 Message Date
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
Johan Hovold fc43e651bf USB: serial: mos7840: remove unused write URB
Remove code to manage a write URB that was never allocated.

Signed-off-by: Johan Hovold <johan@kernel.org>
2017-01-04 10:37:20 +01:00
Johan Hovold 5c75633ef7 USB: serial: mos7840: 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 mos7840_open+0x88/0x8dc [mos7840]

Note that we continue to treat the interrupt-in endpoint as optional for
now.

Fixes: 3f5429746d ("USB: Moschip 7840 USB-Serial Driver")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-01-04 10:37:20 +01:00
Johan Hovold 9da049bced USB: serial: mos7720: remove obsolete port initialisation
Since commit b69578df7e ("USB: usbserial: mos7720: add support for
parallel port on moschip 7715"), the interrupt urb is no longer
submitted at first port open and the endpoint-address initialisation at
port-probe is no longer used.

Signed-off-by: Johan Hovold <johan@kernel.org>
2017-01-04 10:37:20 +01:00
Johan Hovold fde1faf872 USB: serial: mos7720: fix parallel probe
A static usb-serial-driver structure that is used to initialise the
interrupt URB was modified during probe depending on the currently
probed device type, something which could break a parallel probe of a
device of a different type.

Fix this up by overriding the default completion callback for MCS7715
devices in attach() instead. We may want to use two usb-serial driver
instances for the two types later.

Fixes: fb088e335d ("USB: serial: add support for serial port on the
moschip 7715")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-01-04 10:37:20 +01:00
Johan Hovold 75dd211e77 USB: serial: mos7720: fix parport use-after-free on probe errors
Do not submit the interrupt URB until after the parport has been
successfully registered to avoid another use-after-free in the
completion handler when accessing the freed parport private data in case
of a racing completion.

Fixes: b69578df7e ("USB: usbserial: mos7720: add support for parallel
port on moschip 7715")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-01-04 10:37:19 +01:00
Johan Hovold 91a1ff4d53 USB: serial: mos7720: fix use-after-free on probe errors
The interrupt URB was submitted on probe but never stopped on probe
errors. This can lead to use-after-free issues in the completion
handler when accessing the freed usb-serial struct:

Unable to handle kernel paging request at virtual address 6b6b6be7
...
[<bf052e70>] (mos7715_interrupt_callback [mos7720]) from [<c052a894>] (__usb_hcd_giveback_urb+0x80/0x140)
[<c052a894>] (__usb_hcd_giveback_urb) from [<c052a9a4>] (usb_hcd_giveback_urb+0x50/0x138)
[<c052a9a4>] (usb_hcd_giveback_urb) from [<c0550684>] (musb_giveback+0xc8/0x1cc)

Fixes: b69578df7e ("USB: usbserial: mos7720: add support for parallel
port on moschip 7715")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-01-04 10:37:19 +01:00
Johan Hovold b05aebc25f USB: serial: mos7720: fix NULL-deref at open
Fix NULL-pointer dereference at port open if a device lacks the expected
bulk in and out endpoints.

Unable to handle kernel NULL pointer dereference at virtual address 00000030
...
[<bf071c20>] (mos7720_open [mos7720]) from [<bf0490e0>] (serial_port_activate+0x68/0x98 [usbserial])
[<bf0490e0>] (serial_port_activate [usbserial]) from [<c0470ca4>] (tty_port_open+0x9c/0xe8)
[<c0470ca4>] (tty_port_open) from [<bf049d98>] (serial_open+0x48/0x6c [usbserial])
[<bf049d98>] (serial_open [usbserial]) from [<c0469178>] (tty_open+0xcc/0x5cc)

Fixes: 0f64478cbc ("USB: add USB serial mos7720 driver")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-01-04 10:37:19 +01:00
Johan Hovold 21ce578402 USB: serial: kobil_sct: fix NULL-deref in write
Fix NULL-pointer dereference in write() should the device lack the
expected interrupt-out endpoint:

Unable to handle kernel NULL pointer dereference at virtual address 00000054
...
PC is at kobil_write+0x144/0x2a0 [kobil_sct]

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:18 +01:00
Johan Hovold 5d9b0f859b USB: serial: keyspan_pda: verify endpoints at probe
Check for the expected endpoints in attach() and fail loudly if not
present.

Note that failing to do this appears to be benign since da280e3488
("USB: keyspan_pda: clean up write-urb busy handling") which prevents a
NULL-pointer dereference in write() by never marking a non-existent
write-urb as free.

Fixes: 1da177e4c3 ("Linux-2.6.12-rc2")
Cc: stable <stable@vger.kernel.org>	# < v3.3
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-01-04 10:37:18 +01:00
Johan Hovold 90507d54f7 USB: serial: iuu_phoenix: fix NULL-deref at open
Fix NULL-pointer dereference at open should the device lack a bulk-in or
bulk-out endpoint:

Unable to handle kernel NULL pointer dereference at virtual address 00000030
...
PC is at iuu_open+0x78/0x59c [iuu_phoenix]

Fixes: 07c3b1a100 ("USB: remove broken usb-serial num_endpoints
check")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-01-04 10:37:18 +01:00
Johan Hovold e35d6d7c4e USB: serial: io_ti: bind to interface after fw download
Bind to the interface, but do not register any ports, after having
downloaded the firmware. The device will still disconnect and
re-enumerate, but this way we avoid an error messages from being logged
as part of the process:

io_ti: probe of 1-1.3:1.0 failed with error -5

Signed-off-by: Johan Hovold <johan@kernel.org>
2017-01-04 10:37:17 +01:00
Johan Hovold 2330d0a853 USB: serial: io_ti: fix I/O after disconnect
Cancel the heartbeat work on driver unbind in order to avoid I/O after
disconnect in case the port is held open.

Note that the cancel in release() is still needed to stop the heartbeat
after late probe errors.

Fixes: 26c78daade ("USB: io_ti: Add heartbeat to keep idle EP/416
ports from disconnecting")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-01-04 10:37:17 +01:00
Johan Hovold 4f9785cc99 USB: serial: io_ti: fix another NULL-deref at open
In case a device is left in "boot-mode" we must not register any port
devices in order to avoid a NULL-pointer dereference on open due to
missing endpoints. This could be used by a malicious device to trigger
an OOPS:

Unable to handle kernel NULL pointer dereference at virtual address 00000030
...
[<bf0caa84>] (edge_open [io_ti]) from [<bf0b0118>] (serial_port_activate+0x68/0x98 [usbserial])
[<bf0b0118>] (serial_port_activate [usbserial]) from [<c0470ca4>] (tty_port_open+0x9c/0xe8)
[<c0470ca4>] (tty_port_open) from [<bf0b0da0>] (serial_open+0x48/0x6c [usbserial])
[<bf0b0da0>] (serial_open [usbserial]) from [<c0469178>] (tty_open+0xcc/0x5cc)

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:16 +01:00
Johan Hovold a323fefc6f USB: serial: io_ti: fix NULL-deref at open
Fix NULL-pointer dereference when clearing halt at open should a
malicious device lack the expected endpoints when in download mode.

Unable to handle kernel NULL pointer dereference at virtual address 00000030
...
[<bf011ed8>] (edge_open [io_ti]) from [<bf000118>] (serial_port_activate+0x68/0x98 [usbserial])
[<bf000118>] (serial_port_activate [usbserial]) from [<c0470ca4>] (tty_port_open+0x9c/0xe8)
[<c0470ca4>] (tty_port_open) from [<bf000da0>] (serial_open+0x48/0x6c [usbserial])
[<bf000da0>] (serial_open [usbserial]) from [<c0469178>] (tty_open+0xcc/0x5cc)

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:16 +01:00
Johan Hovold 0dd408425e USB: serial: io_edgeport: fix NULL-deref at open
Fix NULL-pointer dereference when initialising URBs at open should a
non-EPIC device lack a bulk-in or interrupt-in endpoint.

Unable to handle kernel NULL pointer dereference at virtual address 00000028
...
PC is at edge_open+0x24c/0x3e8 [io_edgeport]

Note that the EPIC-device probe path has the required sanity checks so
this makes those checks partially redundant.

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:15 +01:00
Johan Hovold c4ac4496e8 USB: serial: garmin_gps: fix memory leak on failed URB submit
Make sure to free the URB transfer buffer in case submission fails (e.g.
due to a disconnect).

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:15 +01:00
Johan Hovold 3dca01114d USB: serial: cyberjack: fix NULL-deref at open
Fix NULL-pointer dereference when clearing halt at open should the device
lack a bulk-out endpoint.

Unable to handle kernel NULL pointer dereference at virtual address 00000030
...
PC is at cyberjack_open+0x40/0x9c [cyberjack]

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:14 +01:00
Geert Uytterhoeven 4271576316 USB: serial: f81534: detect errors from f81534_logic_to_phy_port()
With gcc 4.1.2:

    drivers/usb/serial/f81534.c: In function ‘f81534_port_probe’:
    drivers/usb/serial/f81534.c:1250: warning: comparison is always false due to limited range of data type

f81534_logic_to_phy_port() may return a negative error value, which is
ignored by assigning it to u8 f81534_port_private.phy_num.

Use an intermediate variable of type int to fix this.
While at it, forward the actual error code instead of converting it to
-ENODEV, and drop the useless check for F81534_NUM_PORT, as the callee
always returns a valid port number in case of success.

Fixes: 0c9bd6004d ("USB: serial: add Fintek F81532/534 driver")
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-01-02 10:31:08 +01:00
Giuseppe Lippolis d8a12b7117 USB: serial: option: add dlink dwm-158
Adding registration for 3G modem DWM-158 in usb-serial-option

Signed-off-by: Giuseppe Lippolis <giu.lippolis@gmail.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-12-09 11:44:11 +01:00
Daniele Palmas 5b09eff0c3 USB: serial: option: add support for Telit LE922A PIDs 0x1040, 0x1041
This patch adds support for PIDs 0x1040, 0x1041 of Telit LE922A.

Since the interface positions are the same than the ones used
for other Telit compositions, previous defined blacklists are used.

Signed-off-by: Daniele Palmas <dnlplm@gmail.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-12-09 11:44:11 +01:00
Greg Kroah-Hartman 66c79319f8 USB-serial updates for v4.10-rc1
These updates include a new driver for Fintek F8153x devices, support
 for the GPIO functionality on CP2105 devices, and improved support for
 CH34X devices.
 
 Included are also some clean ups and fixes for various minor issues.
 
 Signed-off-by: Johan Hovold <johan@kernel.org>
 -----BEGIN PGP SIGNATURE-----
 
 iQIuBAABCAAYBQJYQARNERxqb2hhbkBrZXJuZWwub3JnAAoJEEEN5E/e4bSVPxIP
 /i7OTbUIXqh0J/CMUAwRkCK4zrrXhwHCG77uReAiuiFhglR/wAMbPimumV7Daker
 S14XFtyhi7oFBu1A9LkFFI2CTuaOFLnnrYc9Bqxfw8vKnCVMBOfqW7hasumkKY1g
 XWF/IBNQZR3OWqePTefbTgZNXXKe2MMn02XAdswsaxSHXca95eLSu623Rp869H6o
 voJDzj7RLBJCqLSH/IA0MZcdjcQphEVlpFV5wOfx2+4nvhSBQynLPeH79581eUM2
 WsM0lVH9d04AuP5s1CN17cPezBL/cA1dnYThwDXMOC8MI+5resLXP7TalsK5e7pr
 2qezrAiD9bwvqM+8nrEz46qpFLBbT+kM7qmlrHc9QNqm0XLtCdGy268z+omYLGuP
 1cLA/IOFvn9t/o4NiN9+XgQM90MEBSaKdzsdXuIKgHIlHhT057b6K6Kw7oF4kBmO
 S3soInK3edIFnaDEOOvp9UANEw/R6bPjmSMAgQsOZcd1T5OI+WNBhM9kBy/w8XfY
 wLfBLMguoQJbK/06JcKZHL/RDC1VTIjHmUE0ZSu+kjXKweRQJVeYo84438W5QENI
 c2MBxG/7hC+J40LYfWEHUg/HaPVomJV0qRdhx16JtMghXxUBPk1qQqBrlT28CsXh
 N1EqwiK4dn+Jmi7XxoKTk8QFeAn0EQOI4obeNFIy7kNd
 =FChe
 -----END PGP SIGNATURE-----

Merge tag 'usb-serial-4.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/johan/usb-serial into usb-next

Johan writes:

USB-serial updates for v4.10-rc1

These updates include a new driver for Fintek F8153x devices, support
for the GPIO functionality on CP2105 devices, and improved support for
CH34X devices.

Included are also some clean ups and fixes for various minor issues.

Signed-off-by: Johan Hovold <johan@kernel.org>
2016-12-01 16:12:12 +01:00
Pan Bian 3c3dd1e058 USB: serial: kl5kusb105: abort on open exception path
Function klsi_105_open() calls usb_control_msg() (to "enable read") and
checks its return value. When the return value is unexpected, it only
assigns the error code to the return variable retval, but does not
terminate the exception path. This patch fixes the bug by inserting
"goto err_generic_close;" when the call to usb_control_msg() fails.

Fixes: 1da177e4c3 ("Linux-2.6.12-rc2")
Signed-off-by: Pan Bian <bianpan2016@163.com>
[johan: rebase on prerequisite fix and amend commit message]
Signed-off-by: Johan Hovold <johan@kernel.org>
2016-11-30 10:54:30 +01:00
Johan Hovold 6774d5f532 USB: serial: kl5kusb105: fix open error path
Kill urbs and disable read before returning from open on failure to
retrieve the line state.

Fixes: 1da177e4c3 ("Linux-2.6.12-rc2")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2016-11-30 10:54:30 +01:00
Ji-Ze Hong (Peter Hong) 0c9bd6004d USB: serial: add Fintek F81532/534 driver
This driver is for Fintek F81532/F81534 USB to Serial Ports IC.

F81532 spec:
https://drive.google.com/file/d/0B8vRwwYO7aMFOTRRMmhWQVNvajQ/view?usp=
sharing

F81534 spec:
https://drive.google.com/file/d/0B8vRwwYO7aMFV29pQWJqbVBNc00/view?usp=
sharing

Features:
1. F81532 is 1-to-2 & F81534 is 1-to-4 serial ports IC
2. Support Baudrate from B50 to B115200.

Signed-off-by: Ji-Ze Hong (Peter Hong) <hpeter+linux_kernel@gmail.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
2016-11-29 11:13:16 +01:00
Geert Uytterhoeven 009615ab7f USB: serial: cp210x: use tcflag_t to fix incompatible pointer type
On sparc32, tcflag_t is unsigned long, unlike all other architectures:

    drivers/usb/serial/cp210x.c: In function 'cp210x_get_termios':
    drivers/usb/serial/cp210x.c:717:3: warning: passing argument 2 of 'cp210x_get_termios_port' from incompatible pointer type
       cp210x_get_termios_port(tty->driver_data,
       ^
    drivers/usb/serial/cp210x.c:35:13: note: expected 'unsigned int *' but argument is of type 'tcflag_t *'
     static void cp210x_get_termios_port(struct usb_serial_port *port,
		 ^

Consistently use tcflag_t to fix this.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2016-11-21 15:19:01 +01:00
Paul Jakma 2ab13292d7 USB: serial: cp210x: add ID for the Zone DPMX
The BRIM Brothers Zone DPMX is a bicycle powermeter. This ID is for the USB
serial interface in its charging dock for the control pods, via which some
settings for the pods can be modified.

Signed-off-by: Paul Jakma <paul@jakma.org>
Cc: Barry Redmond <barry@brimbrothers.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2016-11-16 17:09:06 +01:00
Johan Hovold 2fbd69c4e3 USB: serial: fix invalid user-pointer checks
Drop invalid user-pointer checks from ioctl handlers.

A NULL-pointer can be valid in user space and copy_to_user() takes care
of sanity checking.

Signed-off-by: Johan Hovold <johan@kernel.org>
2016-11-11 17:54:04 +01:00
Doug Brown 9bfef729a3 USB: serial: ftdi_sio: add support for TI CC3200 LaunchPad
This patch adds support for the TI CC3200 LaunchPad board, which uses a
custom USB vendor ID and product ID. Channel A is used for JTAG, and
channel B is used for a UART.

Signed-off-by: Doug Brown <doug@schmorgal.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2016-11-07 10:23:03 +01:00
Aidan Thornton a98b69002a USB: serial: ch341: add debug output for chip version
Will probably be helpful if there are any more compatibility issues.

Signed-off-by: Aidan Thornton <makosoft@gmail.com>
Reviewed-by: Grigori Goronzy <greg@chown.ath.cx>
Signed-off-by: Johan Hovold <johan@kernel.org>
2016-10-24 17:41:30 +02:00
Aidan Thornton ba781bdf86 USB: serial: ch341: add support for parity, frame length, stop bits
With the new reinitialization method, configuring parity, different
frame lengths and different stop bit settings should work as expected
on both CH340G and CH341A. Tested on a loopback-connected CH340G
with a logic analyzer in a number of different configurations.

Based on a patch by Grigori Goronzy

Signed-off-by: Aidan Thornton <makosoft@gmail.com>
Reviewed-by: Grigori Goronzy <greg@chown.ath.cx>
Signed-off-by: Johan Hovold <johan@kernel.org>
2016-10-24 17:41:25 +02:00
Aidan Thornton 4e46c410e0 USB: serial: ch341: reinitialize chip on reconfiguration
Changing the LCR register after initialization does not seem to be reliable
on all chips (particularly not on CH341A). Restructure initialization and
configuration to always reinit the chip on configuration changes instead and
pass the LCR register value directly to the initialization command.

(Note that baud rates above 500kbaud are incorrect, but they're incorrect in
the same way both before and after this patch at least on the CH340G. Fixing
this isn't a priority as higher baud rates don't seem that reliable anyway.)

Cleaned-up version of a patch by Grigori Goronzy

Signed-off-by: Aidan Thornton <makosoft@gmail.com>
Reviewed-by: Grigori Goronzy <greg@chown.ath.cx>
Signed-off-by: Johan Hovold <johan@kernel.org>
2016-10-24 17:41:19 +02:00
Aidan Thornton 6fde8d29b0 USB: serial: ch341: add register and USB request definitions
No functional changes, this just gives names to some registers and USB
requests based on Grigori Goronzy's work and WinChipTech's Linux driver
(which reassuringly agree), then uses them in place of magic numbers.
This also renames the misnamed BREAK2 register (actually UART config)

Signed-off-by: Aidan Thornton <makosoft@gmail.com>
Reviewed-by: Grigori Goronzy <greg@chown.ath.cx>
Signed-off-by: Johan Hovold <johan@kernel.org>
2016-10-24 17:41:07 +02:00
Johan Hovold 6b7271d253 USB: serial: cp210x: use bool for registered flag
Use bool rather than u8 for the gpio-chip-registered flag.

Signed-off-by: Johan Hovold <johan@kernel.org>
2016-10-24 12:00:19 +02:00
Martyn Welch cf5276ce78 USB: serial: cp210x: Adding GPIO support for CP2105
This patch adds support for the GPIO found on the CP2105. Unlike the GPIO
provided by some of the other devices supported by the cp210x driver, the
GPIO on the CP2015 is muxed on pins otherwise used for serial control
lines. The GPIO have been configured in 2 separate banks as the choice to
configure the pins for GPIO is made separately for pins shared with each
of the 2 serial ports this device provides, though the choice is made for
all pins associated with that port in one go. The choice of whether to use
the pins for GPIO or serial is made by adding configuration to a one-time
programable PROM in the chip and can not be changed at runtime. The device
defaults to GPIO.

This device supports either push-pull or open-drain modes, it doesn't
provide an explicit input mode, though the state of the GPIO can be read
when used in open-drain mode. Like with pin use, the mode is configured in
the one-time programable PROM and can't be changed at runtime.

Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Signed-off-by: Johan Hovold <johan@kernel.org>
2016-10-24 12:00:19 +02:00
Johan Hovold 0407f1ce8f USB: serial: cp210x: return -EIO on short control transfers
Return -EIO on short control transfers rather than -EPROTO which is used
for lower-level transfer errors.

Signed-off-by: Johan Hovold <johan@kernel.org>
2016-10-24 12:00:19 +02:00
Johan Hovold c2b3355920 USB: serial: cp210x: clean up CSIZE handling
CSIZE is two-bit wide and only CS5 through CS8 are possible values.

Signed-off-by: Johan Hovold <johan@kernel.org>
2016-10-24 12:00:19 +02:00
Johan Hovold 126d26f66d USB: serial: fix potential NULL-dereference at probe
Make sure we have at least one port before attempting to register a
console.

Currently, at least one driver binds to a "dummy" interface and requests
zero ports for it. Should such an interface also lack endpoints, we get
a NULL-deref during probe.

Fixes: e5b1e2062e ("USB: serial: make minor allocation dynamic")
Cc: stable <stable@vger.kernel.org>	# 3.11
Signed-off-by: Johan Hovold <johan@kernel.org>
2016-10-21 16:47:17 +02:00
Johan Hovold de24e0a108 USB: serial: cp210x: fix tiocmget error handling
The current tiocmget implementation would fail to report errors up the
stack and instead leaked a few bits from the stack as a mask of
modem-status flags.

Fixes: 39a66b8d22 ("[PATCH] USB: CP2101 Add support for flow control")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2016-10-20 11:15:20 +02:00
Stefan Tauner ca006f785f USB: serial: ftdi_sio: add support for Infineon TriBoard TC2X7
This adds support to ftdi_sio for the Infineon TriBoard TC2X7
engineering board for first-generation Aurix SoCs with Tricore CPUs.
Mere addition of the device IDs does the job.

Signed-off-by: Stefan Tauner <stefan.tauner@technikum-wien.at>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2016-10-17 16:43:54 +02:00
Kyle Jones decc5360f2 USB: serial: cp210x: Add ID for a Juniper console
Signed-off-by: Kyle Jones <kyle@kf5jwc.us>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-27 12:20:17 +02:00
Greg Kroah-Hartman c51f2ff007 Merge 4.8-rc7 into usb-next
We want/need the USB fixes in here as well.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-19 09:12:41 +02:00
Greg Kroah-Hartman eddde28895 USB-serial updates for v4.9-rc1
More clean ups, including a second set of changes from Mathieu as part
 of a major overhaul of the ti_usb_3410_5052 driver.
 
 Signed-off-by: Johan Hovold <johan@kernel.org>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABCAAGBQJX3ArrAAoJEEEN5E/e4bSVcTcP/0wT1GVgq9h25/9D5hBD00MV
 FBywygEzdvnLntWUSb9s8s2OYkBGO79zTpAVFcI6mLVf4lszGdAnZQPv2layr+oX
 EHJgxT3nGoBtl23I1gusBNwLNCjf7aaEAeRXXxI2EKpx5cdC3Qr07cgo0BIiCkvx
 hZwGtmHZvLgz3Nl847w6mdpcp/X0x9h6G3k6/tjXvVUipeGgoyZZ42uXxf1K/bT9
 xpswLr/2cq4O0JH+4HHEK5Ls3Oyo9z00QmW8tX1xlUx+D09xPFh7AVyRVBxD+vos
 C1ouJpVbvXcjTcdB7f4v+C/GljnGIHC7nXZoGPvMEnNjVz5iQ27IStAmks6KzTC+
 hwTf4d2tkX8lYstOwwAaInmnmLSgB8jgw/Lv9EfuZpZ7tWSj/JP/7priKiuaY5sH
 qLwpSg0fRZqGxzytQiTPTvDKxAgawnvuSLeU12v17hUqDsfBnqE1aJu4bLRZN2g3
 BXd8n9RCn7HhV7Zz0ESLIkidnbvjoPyTuLt3CAu38LT2+YQ33BeHROk+/KqUwO/p
 Nt0Sg1V8jF5zoUCxZWTrc0R3fLT3GQ/nAD1cxVZvFnrPz4lH8wigpXdoHMhyN4on
 di6Gw0JQZpZKVI8j3xlOLwxu4i7o53jfIyRx1o97Tone8og2j4XgM93TjcQDy2M0
 4dnSIunZjiiXcbad1uWa
 =4c1M
 -----END PGP SIGNATURE-----

Merge tag 'usb-serial-4.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/johan/usb-serial into usb-next

Johan writes:

USB-serial updates for v4.9-rc1

More clean ups, including a second set of changes from Mathieu as part
of a major overhaul of the ti_usb_3410_5052 driver.

Signed-off-by: Johan Hovold <johan@kernel.org>
2016-09-16 17:42:59 +02:00
Daniele Palmas f190fd9245 USB: serial: simple: add support for another Infineon flashloader
This patch adds support for Infineon flashloader 0x8087/0x0801.

The flashloader is used in Telit LE940B modem family with Telit
flashing application.

Signed-off-by: Daniele Palmas <dnlplm@gmail.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2016-09-12 10:19:41 +02:00