Jingchang Lu | 21 Oct 10:50 2014

[PATCH] serial: of-serial: fix uninitialized kmalloc variable

The info pointer points to an uninitialized kmalloced space.
If a device doesn't have clk property, then info->clk may
have unpredicated value and cause call trace. So use kzalloc
to make sure it is NULL initialized.

Signed-off-by: Jingchang Lu <jingchang.lu <at> freescale.com>
---
 drivers/tty/serial/of_serial.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/of_serial.c b/drivers/tty/serial/of_serial.c
index 8bc2563..56982da4 100644
--- a/drivers/tty/serial/of_serial.c
+++ b/drivers/tty/serial/of_serial.c
 <at>  <at>  -158,7 +158,7  <at>  <at>  static int of_platform_serial_probe(struct platform_device *ofdev)
 	if (of_find_property(ofdev->dev.of_node, "used-by-rtas", NULL))
 		return -EBUSY;

-	info = kmalloc(sizeof(*info), GFP_KERNEL);
+	info = kzalloc(sizeof(*info), GFP_KERNEL);
 	if (info == NULL)
 		return -ENOMEM;

--

-- 
1.8.0

--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo <at> vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
(Continue reading)

Kevin Cernekee | 20 Oct 22:53 2014
Picon

[PATCH V2 0/9] bcm63xx_uart and of-serial updates

In the course of bringing up a new platform[1] that uses this hardware,
I made a couple of improvements:

 - Allow the driver to be built for targets that do not define
   CONFIG_BCM63xx (as mine doesn't)
 - Use devm_ioremap_resource() to simplify the initialization code
 - Allow OF earlycon to be hardwired "on" in the kernel build, so it can
   eventually replace the MIPS EARLY_PRINTK scheme
 - Update documentation; fix typos/grammar

V1->V2:

 - Add acks from Florian
 - Rebase on tty-next (3.18-rc1)
 - bcm63xx_uart: add patches 3,4,6
 - Rework my earlycon change (patches 7,8) to use a config option
   instead of a function call

[1] https://github.com/cernekee/linux/commits/bcm3384

Kevin Cernekee (9):
  tty: serial: bcm63xx: Allow bcm63xx_uart to be built on other
    platforms
  tty: serial: bcm63xx: Update the Kconfig help text
  tty: serial: bcm63xx: Fix typo in MODULE_DESCRIPTION
  Documentation: DT: Add entries for bcm63xx UART
  tty: serial: bcm63xx: Enable DT earlycon support
  tty: serial: bcm63xx: Eliminate unnecessary request/release functions
  tty: serial: of-serial: Suppress warnings if OF earlycon is invoked
    twice
(Continue reading)

Kevin Cernekee | 19 Oct 19:26 2014
Picon

[PATCH 4/3] tty: serial: bcm63xx: Enable DT earlycon support

This enables early console output if there is a chosen/stdout-path
property referencing a UART node with the "brcm,bcm6345-uart" compatible
string.  The bootloader sets up the pinmux and baud/parity/etc.
Tested on bcm3384 (MIPS, DT).

Signed-off-by: Kevin Cernekee <cernekee <at> gmail.com>
---
 drivers/tty/serial/Kconfig        |  1 +
 drivers/tty/serial/bcm63xx_uart.c | 20 ++++++++++++++++++++
 2 files changed, 21 insertions(+)

diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
index 815b652..fdd851e 100644
--- a/drivers/tty/serial/Kconfig
+++ b/drivers/tty/serial/Kconfig
 <at>  <at>  -1297,6 +1297,7  <at>  <at>  config SERIAL_BCM63XX_CONSOLE
 	bool "Console on BCM63xx serial port"
 	depends on SERIAL_BCM63XX=y
 	select SERIAL_CORE_CONSOLE
+	select SERIAL_EARLYCON
 	help
 	  If you have enabled the serial port on the BCM63xx CPU
 	  you can make it the console by answering Y to this option.
diff --git a/drivers/tty/serial/bcm63xx_uart.c b/drivers/tty/serial/bcm63xx_uart.c
index 2315190..48bd509 100644
--- a/drivers/tty/serial/bcm63xx_uart.c
+++ b/drivers/tty/serial/bcm63xx_uart.c
 <at>  <at>  -782,6 +782,26  <at>  <at>  static int __init bcm63xx_console_init(void)

 console_initcall(bcm63xx_console_init);
(Continue reading)

Kevin Cernekee | 19 Oct 04:30 2014
Picon

[PATCH 1/3] tty: serial: bcm63xx: Allow bcm63xx_uart to be built on other platforms

This device was originally supported on bcm63xx only, but it shows up on
a wide variety of MIPS and ARM chipsets spanning multiple product lines.
Now that the driver has eliminated dependencies on bcm63xx-specific
header files, we can build it on any non-bcm63xx kernel.

Compile-tested on x86, both statically and as a module.  Tested for
functionality on bcm3384 (a new MIPS platform under active development).

Signed-off-by: Kevin Cernekee <cernekee <at> gmail.com>
---
 drivers/tty/serial/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
index 649b784..4a5c0c8 100644
--- a/drivers/tty/serial/Kconfig
+++ b/drivers/tty/serial/Kconfig
 <at>  <at>  -1283,7 +1283,7  <at>  <at>  config SERIAL_TIMBERDALE
 config SERIAL_BCM63XX
 	tristate "bcm63xx serial port support"
 	select SERIAL_CORE
-	depends on BCM63XX
+	depends on MIPS || ARM || COMPILE_TEST
 	help
 	  If you have a bcm63xx CPU, you can enable its onboard
 	  serial port by enabling this options.
--

-- 
2.1.1

--
(Continue reading)

Peter Hurley | 16 Oct 22:54 2014

[PATCH -next 00/10] serial core fixes

Hi Greg,

The first 3 patches are picked out from the closing series that was
split up; the first 2 patches lay the groundwork for the fixing
the locking for the ->set_termios() method.

The 2 UPF_*/ASYNC* patches are to bind the definitions together
since userspace only gets one set of definitions, but the code
operates as if the definitions are synch'd.

The remainder except the last patch are cleanups; the last patch
fixes port count mismatch in uart_open()/uart_close(), which
Geert and I discussed a while back. So one less thing on my todo
list.

Still on the todo list:
1. Some tty_port flags usage is non-atomic.
2. uart_remove_one_port will happily remove an in-use port since
   there's no reference counting.
3. fixing autoRTS for omap (so it clears RTS when tiocmset drops
   RTS)

Regards,

Peter Hurley (10):
  serial: Refactor uart_flush_buffer() from uart_close()
  serial: core: Flush ldisc after dropping port mutex in uart_close()
  serial: Fix locking for uart driver set_termios() method
  tty,serial: Unify UPF_* and ASYNC_* flag definitions
  tty: Document defunct ASYNC_* bits in uapi header
(Continue reading)

John Crispin | 16 Oct 22:43 2014

[PATCH] serial: of_serial: add "ralink,rt2880-uart" to the binding documentation

Signed-off-by: John Crispin <blogic <at> openwrt.org>
---
 Documentation/devicetree/bindings/serial/of-serial.txt |    1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/serial/of-serial.txt b/Documentation/devicetree/bindings/serial/of-serial.txt
index 7705477..67a5b3c 100644
--- a/Documentation/devicetree/bindings/serial/of-serial.txt
+++ b/Documentation/devicetree/bindings/serial/of-serial.txt
 <at>  <at>  -10,6 +10,7  <at>  <at>  Required properties:
 	- "ns16850"
 	- "nvidia,tegra20-uart"
 	- "nxp,lpc3220-uart"
+	- "ralink,rt2880-uart"
 	- "ibm,qpace-nwp-serial"
 	- "altr,16550-FIFO32"
 	- "altr,16550-FIFO64"
--

-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo <at> vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Peter Hurley | 16 Oct 22:24 2014

[PATCH -next 00/27] tty locking changes

Hi Greg,

This patch series has 3 major changes to how tty locking behaves:
1. the lock order of tty_lock() and tty->ldisc_sem is reversed;
   this eliminates a bunch of lock drop/reacquire which, in turn,
   eliminates tty state tracking that can no longer be observed.
   This also allows the pty driver to wait for input processing to
   complete while closing before setting TTY_OTHER_CLOSED (which
   eliminates the ugliness of checking input twice in n_tty_read() and
   n_tty_poll()).
2. the footprint of tty_mutex is reduced to only adding and removing
   ttys and is no longer held to acquire the tty_lock() in tty_open();
   this allows for multiple ttys to be opened concurrently, even if
   one open stalls waiting for its tty_lock().
3. pty pair locking is reordered to master first, then slave, rather
   than by address. This works because, while releasing the master pty,
   the slave tty count needs to be changed, whereas, when releasing the
   slave, the master pty does not need to be accessed.
   This furthur eliminates more lock drop/reacquire.

The longer-term goals, which this series builds towards, is:
1. simplifying the tty open/close behavior
2. eliminating the ASYNC_CLOSING code without breaking existing userspace
3. eliminating returning -EIO from tty_open(). Not sure if this is possible yet.

Regards,

Peter Hurley (27):
  tty: Don't hold tty_lock for ldisc release
  tty: Invert tty_lock/ldisc_sem lock order
(Continue reading)

John Crispin | 16 Oct 21:48 2014

[PATCH 1/2] serial: of: add a PORT_RT2880 definition

The Ralink RT2880 SoC and its successors have an internal 8250 core. This core
needs the same quirks applied as the AMD AU1xxx uart. In addition to these
quirks, the ports memory region is only 0x100 unlike the AU1xxx which has a
size of 0x1000.

Signed-off-by: John Crispin <blogic <at> openwrt.org>
---
 drivers/tty/serial/8250/8250_core.c |    5 ++++-
 drivers/tty/serial/of_serial.c      |   10 +++++++++-
 include/uapi/linux/serial_core.h    |    3 ++-
 3 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c
index 1d42dba..f487b13 100644
--- a/drivers/tty/serial/8250/8250_core.c
+++ b/drivers/tty/serial/8250/8250_core.c
 <at>  <at>  -2502,8 +2502,11  <at>  <at>  serial8250_pm(struct uart_port *port, unsigned int state,

 static unsigned int serial8250_port_size(struct uart_8250_port *pt)
 {
-	if (pt->port.iotype == UPIO_AU)
+	if (pt->port.iotype == UPIO_AU) {
+		if (pt->port.type == PORT_RT2880)
+			return 0x100;
 		return 0x1000;
+	}
 	if (is_omap1_8250(pt))
 		return 0x16 << pt->port.regshift;

diff --git a/drivers/tty/serial/of_serial.c b/drivers/tty/serial/of_serial.c
(Continue reading)

Peter Hurley | 16 Oct 21:36 2014

[PATCH -next] n_tty: Remove stale read lock comment

The stale comment refers to lock behavior which was eliminated in
commit 6d76bd2618535c581f1673047b8341fd291abc67,
n_tty: Make N_TTY ldisc receive path lockless.

Signed-off-by: Peter Hurley <peter <at> hurleysoftware.com>
---
 drivers/tty/n_tty.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
index 379f60c..38ac7b9 100644
--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
 <at>  <at>  -2248,8 +2248,6  <at>  <at>  static ssize_t n_tty_read(struct tty_struct *tty, struct file *file,
 				nr--;
 			}

-			/* The copy function takes the read lock and handles
-			   locking internally for this case */
 			uncopied = copy_from_read_buf(tty, &b, &nr);
 			uncopied += copy_from_read_buf(tty, &b, &nr);
 			if (uncopied) {
--

-- 
2.1.1

--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo <at> vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

(Continue reading)

Peter Hurley | 16 Oct 21:33 2014

[PATCH -next 0/9] pty fixes

Hi Greg,

This series addresses some pecularities of the pty driver, especially
set_termios() handling, which is moved into the pty driver proper, and
packet mode/ctrl_lock behavior.

Regards,

Peter Hurley (9):
  tty: WARN for attempted set_termios() of pty master
  tty: Move pty-specific set_termios() handling to pty driver
  pty: Use spin_lock_irq() for pty_set_termios()
  tty: Use spin_lock_irq() for ctrl_lock when interrupts enabled
  pty: Don't claim slave's ctrl_lock for master's packet mode
  pty: Fix packet mode setting race
  pty: Hold ctrl_lock for packet mode updates
  tty: Fix missed wakeup from packet mode status update
  n_tty: Only process packet mode data in raw mode

 drivers/tty/n_tty.c     | 39 +++++++++++++++++++------------------
 drivers/tty/pty.c       | 51 ++++++++++++++++++++++++++++++++++++-------------
 drivers/tty/tty_ioctl.c | 34 ++++-----------------------------
 3 files changed, 62 insertions(+), 62 deletions(-)

--

-- 
2.1.1

--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo <at> vger.kernel.org
(Continue reading)

Peter Hurley | 16 Oct 20:59 2014

[PATCH -next 00/10] Fixes to controlling tty handling

Hi Greg,

This patch series:
1. removes stale code from the controlling tty handling functions
2. relocates the ctty functions to eliminate forward declarations
3. fixes several unsafe races when setting the controlling tty
4. eliminates holding tty_mutex as a necessary condition of
   setting the controlling terminal

#4 is part of an overall effort to reduce the tty_mutex footprint.

Unfortunately, this series does not fix two other race conditions:
1. disassociate_ctty()/no_tty() does not teardown the tty<->process
associations atomically wrt job control, so it is possible to
observe spurious error conditions from job control (tty_check_change()
and job_control()). I'm looking into inverting the lock order of
tty->ctrl_lock and tsk->sighand->siglock() to see if holding ctrl_lock
is a suitable solution for atomic teardown. Especially now that
ctrl_lock is not used for flow control anymore :)
2. task_pgrp() and task_session() are used unsafely. These fixes
will be clearer after #1 is fixed.

Regards,

Peter Hurley (10):
  tty: Remove tty_pair_get_tty()/tty_pair_get_pty() api
  tty: Reorder proc_set_tty() and related fns
  tty: Remove tsk parameter from proc_set_tty()
  uml: Fix unsafe pid reference to foreground process group
  tty: Replace open-coded tty_get_pgrp()
(Continue reading)


Gmane