1. 21 5月, 2014 1 次提交
  2. 04 5月, 2014 7 次提交
    • R
      tty/serial: fix generic earlycon option parsing · e26f1db9
      Rob Herring 提交于
      Commit 9aac5887 (tty/serial: add generic serial earlycon) moved
      console option parsing from 8250_early.c and converted to kstrto*
      functions from simple_strtoul along the way. However, kstrto* functions
      are not equivalent in that they do not allow non-convertible characters
      at the end such as "115200n8". Fix this by changing back to
      simple_strtoul and ignore what checkpatch.pl says.
      Reported-by: NYinghai Lu <yinghai@kernel.org>
      Cc: Jiri Slaby <jslaby@suse.cz>
      Cc: linux-serial@vger.kernel.org
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e26f1db9
    • R
      tty/serial: add back missing setup_early_serial8250_console · fe1cf8af
      Rob Herring 提交于
      Commit d2fd6810 (tty/serial: convert 8250 to generic earlycon)
      removed setup_early_serial8250_console, but there are still 2 callers
      in:
      
      arch/mips/mti-malta/malta-init.c
      drivers/firmware/pcdp.c
      
      Add back the function implemented as a wrapper to setup_earlycon.
      Reported-by: NYinghai Lu <yinghai@kernel.org>
      Cc: Jiri Slaby <jslaby@suse.cz>
      Cc: linux-serial@vger.kernel.org
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      fe1cf8af
    • P
      tty: Fix lockless tty buffer race · 62a0d8d7
      Peter Hurley 提交于
      Commit 6a20dbd6,
      "tty: Fix race condition between __tty_buffer_request_room and flush_to_ldisc"
      correctly identifies an unsafe race condition between
      __tty_buffer_request_room() and flush_to_ldisc(), where the consumer
      flush_to_ldisc() prematurely advances the head before consuming the
      last of the data committed. For example:
      
                 CPU 0                     |            CPU 1
      __tty_buffer_request_room            | flush_to_ldisc
        ...                                |   ...
                                           |   count = head->commit - head->read
        n = tty_buffer_alloc()             |
        b->commit = b->used                |
        b->next = n                        |
                                           |   if (!count)                /* T */
                                           |     if (head->next == NULL)  /* F */
                                           |     buf->head = head->next
      
      In this case, buf->head has been advanced but head->commit may have
      been updated with a new value.
      
      Instead of reintroducing an unnecessary lock, fix the race locklessly.
      Read the commit-next pair in the reverse order of writing, which guarantees
      the commit value read is the latest value written if the head is
      advancing.
      Reported-by: NManfred Schlaegl <manfred.schlaegl@gmx.at>
      Cc: <stable@vger.kernel.org> # 3.12.x+
      Signed-off-by: NPeter Hurley <peter@hurleysoftware.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      62a0d8d7
    • P
      Revert "tty: Fix race condition between __tty_buffer_request_room and flush_to_ldisc" · 5fbf1a65
      Peter Hurley 提交于
      This reverts commit 6a20dbd6.
      
      Although the commit correctly identifies an unsafe race condition
      between __tty_buffer_request_room() and flush_to_ldisc(), the commit
      fixes the race with an unnecessary spinlock in a lockless algorithm.
      
      The follow-on commit, "tty: Fix lockless tty buffer race" fixes
      the race locklessly.
      Signed-off-by: NPeter Hurley <peter@hurleysoftware.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5fbf1a65
    • T
      drivers/tty/hvc: don't free hvc_console_setup after init · 501fed45
      Tomoki Sekiyama 提交于
      When 'console=hvc0' is specified to the kernel parameter in x86 KVM guest,
      hvc console is setup within a kthread. However, that will cause SEGV
      and the boot will fail when the driver is builtin to the kernel,
      because currently hvc_console_setup() is annotated with '__init'. This
      patch removes '__init' to boot the guest successfully with 'console=hvc0'.
      Signed-off-by: NTomoki Sekiyama <tomoki.sekiyama@hds.com>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      501fed45
    • P
      n_tty: Fix n_tty_write crash when echoing in raw mode · 4291086b
      Peter Hurley 提交于
      The tty atomic_write_lock does not provide an exclusion guarantee for
      the tty driver if the termios settings are LECHO & !OPOST.  And since
      it is unexpected and not allowed to call TTY buffer helpers like
      tty_insert_flip_string concurrently, this may lead to crashes when
      concurrect writers call pty_write. In that case the following two
      writers:
      * the ECHOing from a workqueue and
      * pty_write from the process
      race and can overflow the corresponding TTY buffer like follows.
      
      If we look into tty_insert_flip_string_fixed_flag, there is:
        int space = __tty_buffer_request_room(port, goal, flags);
        struct tty_buffer *tb = port->buf.tail;
        ...
        memcpy(char_buf_ptr(tb, tb->used), chars, space);
        ...
        tb->used += space;
      
      so the race of the two can result in something like this:
                    A                                B
      __tty_buffer_request_room
                                        __tty_buffer_request_room
      memcpy(buf(tb->used), ...)
      tb->used += space;
                                        memcpy(buf(tb->used), ...) ->BOOM
      
      B's memcpy is past the tty_buffer due to the previous A's tb->used
      increment.
      
      Since the N_TTY line discipline input processing can output
      concurrently with a tty write, obtain the N_TTY ldisc output_lock to
      serialize echo output with normal tty writes.  This ensures the tty
      buffer helper tty_insert_flip_string is not called concurrently and
      everything is fine.
      
      Note that this is nicely reproducible by an ordinary user using
      forkpty and some setup around that (raw termios + ECHO). And it is
      present in kernels at least after commit
      d945cb9c (pty: Rework the pty layer to
      use the normal buffering logic) in 2.6.31-rc3.
      
      js: add more info to the commit log
      js: switch to bool
      js: lock unconditionally
      js: lock only the tty->ops->write call
      
      References: CVE-2014-0196
      Reported-and-tested-by: NJiri Slaby <jslaby@suse.cz>
      Signed-off-by: NPeter Hurley <peter@hurleysoftware.com>
      Signed-off-by: NJiri Slaby <jslaby@suse.cz>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4291086b
    • M
      tty: serial: 8250_core.c Bug fix for Exar chips. · b790f210
      Michael Welling 提交于
      The sleep function was updated to put the serial port to sleep only when necessary.
      This appears to resolve the errant behavior of the driver as described in
      Kernel Bug 61961 – "My Exar Corp. XR17C/D152 Dual PCI UART modem does not
      work with 3.8.0".
      Signed-off-by: NMichael Welling <mwelling@ieee.org>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b790f210
  3. 26 4月, 2014 3 次提交
  4. 25 4月, 2014 29 次提交