<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/usb/serial/console.c, branch v4.4.235</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v4.4.235</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v4.4.235'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2017-10-18T07:20:43+00:00</updated>
<entry>
<title>USB: serial: console: fix use-after-free after failed setup</title>
<updated>2017-10-18T07:20:43+00:00</updated>
<author>
<name>Johan Hovold</name>
<email>johan@kernel.org</email>
</author>
<published>2017-10-04T09:01:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=208563455aac7540755bb9d8e8edaf7c5ef61d8c'/>
<id>urn:sha1:208563455aac7540755bb9d8e8edaf7c5ef61d8c</id>
<content type='text'>
commit 299d7572e46f98534033a9e65973f13ad1ce9047 upstream.

Make sure to reset the USB-console port pointer when console setup fails
in order to avoid having the struct usb_serial be prematurely freed by
the console code when the device is later disconnected.

Fixes: 73e487fdb75f ("[PATCH] USB console: fix disconnection issues")
Acked-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Johan Hovold &lt;johan@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>USB: console: add dummy __module_get</title>
<updated>2015-02-26T16:06:39+00:00</updated>
<author>
<name>Johan Hovold</name>
<email>johan@kernel.org</email>
</author>
<published>2015-02-16T06:17:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=5ee0089b1f7057d8f783db37b2a8116cd114f6e5'/>
<id>urn:sha1:5ee0089b1f7057d8f783db37b2a8116cd114f6e5</id>
<content type='text'>
Add call to __module_get when initialising the fake tty in
usb_console_setup to match the module_put in release_one_tty.

Note that the tty-driver (i.e. usb-serial core) must be compiled-in to
enable the usb console so the __module_get is essentially a noop as
driver-&gt;owner will be null.

Reported-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
Signed-off-by: Johan Hovold &lt;johan@kernel.org&gt;
</content>
</entry>
<entry>
<title>USB: console: fix potential use after free</title>
<updated>2015-01-10T11:48:21+00:00</updated>
<author>
<name>Johan Hovold</name>
<email>johan@kernel.org</email>
</author>
<published>2015-01-05T15:04:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=32a4bf2e81ec378e5925d4e069e0677a6c86a6ad'/>
<id>urn:sha1:32a4bf2e81ec378e5925d4e069e0677a6c86a6ad</id>
<content type='text'>
Use tty kref to release the fake tty in usb_console_setup to avoid use
after free if the underlying serial driver has acquired a reference.

Note that using the tty destructor release_one_tty requires some more
state to be initialised.

Fixes: 4a90f09b20f4 ("tty: usb-serial krefs")
Cc: stable &lt;stable@vger.kernel.org&gt;
Signed-off-by: Johan Hovold &lt;johan@kernel.org&gt;
</content>
</entry>
<entry>
<title>USB: console: fix uninitialised ldisc semaphore</title>
<updated>2015-01-10T11:48:15+00:00</updated>
<author>
<name>Johan Hovold</name>
<email>johan@kernel.org</email>
</author>
<published>2015-01-05T15:04:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=d269d4434c72ed0da3a9b1230c30da82c4918c63'/>
<id>urn:sha1:d269d4434c72ed0da3a9b1230c30da82c4918c63</id>
<content type='text'>
The USB console currently allocates a temporary fake tty which is used
to pass terminal settings to the underlying serial driver.

The tty struct is not fully initialised, something which can lead to a
lockdep warning (or worse) if a serial driver tries to acquire a
line-discipline reference:

	usbserial: USB Serial support registered for pl2303
	pl2303 1-2.1:1.0: pl2303 converter detected
	usb 1-2.1: pl2303 converter now attached to ttyUSB0
	INFO: trying to register non-static key.
	the code is fine but needs lockdep annotation.
	turning off the locking correctness validator.
	CPU: 0 PID: 68 Comm: udevd Tainted: G        W      3.18.0-rc5 #10
	[&lt;c0016f04&gt;] (unwind_backtrace) from [&lt;c0013978&gt;] (show_stack+0x20/0x24)
	[&lt;c0013978&gt;] (show_stack) from [&lt;c0449794&gt;] (dump_stack+0x24/0x28)
	[&lt;c0449794&gt;] (dump_stack) from [&lt;c006f730&gt;] (__lock_acquire+0x1e50/0x2004)
	[&lt;c006f730&gt;] (__lock_acquire) from [&lt;c0070128&gt;] (lock_acquire+0xe4/0x18c)
	[&lt;c0070128&gt;] (lock_acquire) from [&lt;c027c6f8&gt;] (ldsem_down_read_trylock+0x78/0x90)
	[&lt;c027c6f8&gt;] (ldsem_down_read_trylock) from [&lt;c027a1cc&gt;] (tty_ldisc_ref+0x24/0x58)
	[&lt;c027a1cc&gt;] (tty_ldisc_ref) from [&lt;c0340760&gt;] (usb_serial_handle_dcd_change+0x48/0xe8)
	[&lt;c0340760&gt;] (usb_serial_handle_dcd_change) from [&lt;bf000484&gt;] (pl2303_read_int_callback+0x210/0x220 [pl2303])
	[&lt;bf000484&gt;] (pl2303_read_int_callback [pl2303]) from [&lt;c031624c&gt;] (__usb_hcd_giveback_urb+0x80/0x140)
	[&lt;c031624c&gt;] (__usb_hcd_giveback_urb) from [&lt;c0316fc0&gt;] (usb_giveback_urb_bh+0x98/0xd4)
	[&lt;c0316fc0&gt;] (usb_giveback_urb_bh) from [&lt;c0042e44&gt;] (tasklet_hi_action+0x9c/0x108)
	[&lt;c0042e44&gt;] (tasklet_hi_action) from [&lt;c0042380&gt;] (__do_softirq+0x148/0x42c)
	[&lt;c0042380&gt;] (__do_softirq) from [&lt;c00429cc&gt;] (irq_exit+0xd8/0x114)
	[&lt;c00429cc&gt;] (irq_exit) from [&lt;c007ae58&gt;] (__handle_domain_irq+0x84/0xdc)
	[&lt;c007ae58&gt;] (__handle_domain_irq) from [&lt;c000879c&gt;] (omap_intc_handle_irq+0xd8/0xe0)
	[&lt;c000879c&gt;] (omap_intc_handle_irq) from [&lt;c0014544&gt;] (__irq_svc+0x44/0x7c)
	Exception stack(0xdf4e7f08 to 0xdf4e7f50)
	7f00:                   debc0b80 df4e7f5c 00000000 00000000 debc0b80 be8da96c
	7f20: 00000000 00000128 c000fc84 df4e6000 00000000 df4e7f94 00000004 df4e7f50
	7f40: c038ebc0 c038d74c 600f0013 ffffffff
	[&lt;c0014544&gt;] (__irq_svc) from [&lt;c038d74c&gt;] (___sys_sendmsg.part.29+0x0/0x2e0)
	[&lt;c038d74c&gt;] (___sys_sendmsg.part.29) from [&lt;c038ec08&gt;] (SyS_sendmsg+0x18/0x1c)
	[&lt;c038ec08&gt;] (SyS_sendmsg) from [&lt;c000fa00&gt;] (ret_fast_syscall+0x0/0x48)
	console [ttyUSB0] enabled

Fixes: 36697529b5bb ("tty: Replace ldisc locking with ldisc_sem")
Cc: stable &lt;stable@vger.kernel.org&gt;
Signed-off-by: Johan Hovold &lt;johan@kernel.org&gt;
</content>
</entry>
<entry>
<title>usb: delete non-required instances of include &lt;linux/init.h&gt;</title>
<updated>2014-01-08T23:01:39+00:00</updated>
<author>
<name>Paul Gortmaker</name>
<email>paul.gortmaker@windriver.com</email>
</author>
<published>2014-01-08T16:08:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=803a536243b3a1ed2289f41897b11b72bd083309'/>
<id>urn:sha1:803a536243b3a1ed2289f41897b11b72bd083309</id>
<content type='text'>
None of these files are actually using any __init type directives
and hence don't need to include &lt;linux/init.h&gt;.  Most are just a
left over from __devinit and __cpuinit removal, or simply due to
code getting copied from one driver to the next.

Signed-off-by: Paul Gortmaker &lt;paul.gortmaker@windriver.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>USB: serial: remove redundant OOM messages</title>
<updated>2014-01-03T20:31:46+00:00</updated>
<author>
<name>Johan Hovold</name>
<email>jhovold@gmail.com</email>
</author>
<published>2013-12-29T18:22:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=10c642d0772ac1391ae4f9fdeb13217ab019117a'/>
<id>urn:sha1:10c642d0772ac1391ae4f9fdeb13217ab019117a</id>
<content type='text'>
Remove redundant error messages on allocation failures, which have
already been logged.

Cc: Joe Perches &lt;joe@perches.com&gt;
Signed-off-by: Johan Hovold &lt;jhovold@gmail.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>USB: console: remove unnecessary operations test</title>
<updated>2013-07-23T23:24:32+00:00</updated>
<author>
<name>Johan Hovold</name>
<email>jhovold@gmail.com</email>
</author>
<published>2013-06-26T14:47:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=c7b13475b4466adcdcd8378f12b4ee416ef9b98b'/>
<id>urn:sha1:c7b13475b4466adcdcd8378f12b4ee416ef9b98b</id>
<content type='text'>
Remove unnecessary tests for open and write operations as these are set
to the generic implementations by usb-serial core if left unset by a
subdriver.

Signed-off-by: Johan Hovold &lt;jhovold@gmail.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>USB: console: use dev_dbg</title>
<updated>2013-07-23T23:24:32+00:00</updated>
<author>
<name>Johan Hovold</name>
<email>jhovold@gmail.com</email>
</author>
<published>2013-06-26T14:47:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=7b94cae47cbfaa1a64cd51b3735eba3abe6af827'/>
<id>urn:sha1:7b94cae47cbfaa1a64cd51b3735eba3abe6af827</id>
<content type='text'>
Use dev_dbg for debugging.

Signed-off-by: Johan Hovold &lt;jhovold@gmail.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>USB: serial: make minor allocation dynamic</title>
<updated>2013-06-17T20:30:02+00:00</updated>
<author>
<name>Greg Kroah-Hartman</name>
<email>gregkh@linuxfoundation.org</email>
</author>
<published>2013-06-07T18:04:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=e5b1e2062e0535e8ffef79bb34d857e21380d101'/>
<id>urn:sha1:e5b1e2062e0535e8ffef79bb34d857e21380d101</id>
<content type='text'>
This moves the allocation of minor device numbers from a static array to
be dynamic, using the idr interface.  This means that you could
potentially get "gaps" in a minor number range for a single USB serial
device with multiple ports, but all should still work properly.

We remove the 'minor' field from the usb_serial structure, as it no
longer makes any sense for it (use the field in the usb_serial_port
structure if you really want to know this number), and take the fact
that we were overloading a number in this field to determine if we had
initialized the minor numbers or not, and just use a flag variable
instead.

Note, we still have the limitation of 255 USB to serial devices in the
system, as that is all we are registering with the TTY layer at this
point in time.

Tested-by: Tobias Winter &lt;tobias@linuxdingsda.de&gt;
Reviewed-by: Johan Hovold &lt;jhovold@gmail.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>USB: serial: ports: add minor and port number</title>
<updated>2013-06-10T21:46:40+00:00</updated>
<author>
<name>Greg Kroah-Hartman</name>
<email>gregkh@linuxfoundation.org</email>
</author>
<published>2013-06-06T17:32:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=1143832eca8f1d64da7d85642c956ae9d25c69e1'/>
<id>urn:sha1:1143832eca8f1d64da7d85642c956ae9d25c69e1</id>
<content type='text'>
The usb_serial_port structure had the number field, which was the minor
number for the port, which almost no one really cared about.  They
really wanted the number of the port within the device, which you had to
subtract from the minor of the parent usb_serial_device structure.  To
clean this up, provide the real minor number of the port, and the number
of the port within the serial device separately, as these numbers might
not be related in the future.

Bonus is that this cleans up a lot of logic in the drivers, and saves
lines overall.

Tested-by: Tobias Winter &lt;tobias@linuxdingsda.de&gt;
Reviewed-by: Johan Hovold &lt;jhovold@gmail.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

--
 drivers/staging/serqt_usb2/serqt_usb2.c |   21 +++--------
 drivers/usb/serial/ark3116.c            |    2 -
 drivers/usb/serial/bus.c                |    6 +--
 drivers/usb/serial/console.c            |    2 -
 drivers/usb/serial/cp210x.c             |    2 -
 drivers/usb/serial/cypress_m8.c         |    4 +-
 drivers/usb/serial/digi_acceleport.c    |    6 ---
 drivers/usb/serial/f81232.c             |    5 +-
 drivers/usb/serial/garmin_gps.c         |    6 +--
 drivers/usb/serial/io_edgeport.c        |   58 ++++++++++++--------------------
 drivers/usb/serial/io_ti.c              |   21 ++++-------
 drivers/usb/serial/keyspan.c            |   29 +++++++---------
 drivers/usb/serial/metro-usb.c          |    4 +-
 drivers/usb/serial/mos7720.c            |   37 +++++++++-----------
 drivers/usb/serial/mos7840.c            |   52 +++++++++-------------------
 drivers/usb/serial/opticon.c            |    2 -
 drivers/usb/serial/pl2303.c             |    2 -
 drivers/usb/serial/quatech2.c           |    7 +--
 drivers/usb/serial/sierra.c             |    2 -
 drivers/usb/serial/ti_usb_3410_5052.c   |   10 ++---
 drivers/usb/serial/usb-serial.c         |    7 ++-
 drivers/usb/serial/usb_wwan.c           |    2 -
 drivers/usb/serial/whiteheat.c          |   20 +++++------
 include/linux/usb/serial.h              |    6 ++-
 24 files changed, 133 insertions(+), 180 deletions(-)
</content>
</entry>
</feed>
