1. 31 3月, 2017 4 次提交
  2. 29 3月, 2017 1 次提交
  3. 17 3月, 2017 13 次提交
    • P
      serial: 8250_dw: simplify optional reset handling · acbdad8d
      Philipp Zabel 提交于
      As of commit bb475230 ("reset: make optional functions really
      optional"), the reset framework API calls use NULL pointers to describe
      optional, non-present reset controls.
      
      This allows to return errors from devm_reset_control_get_optional and to
      call reset_control_(de)assert unconditionally.
      Signed-off-by: NPhilipp Zabel <p.zabel@pengutronix.de>
      Reviewed-by: NAndy Shevchenko <andy.shevchenko@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      acbdad8d
    • J
      tty: serial_core, remove state checks in uart_poll* · 22077b09
      Jiri Slaby 提交于
      Coverity complains about uart_state checks in polling functions. And it
      is indeed correct. We do something like this:
      	struct uart_state *state = drv->state + line;
      	if (!state)
      		return;
      
      Adding 'line' to drv->state would move the potential NULL pointer to
      something near NULL and the check is useless. Even if we checked pure
      drv->state, nothing guarantees it is not freed and NULLed after the
      check. So if the only user of this interface (kgdboc) needs to assure
      something, this is neither the correct thing, nor place to do so.
      Signed-off-by: NJiri Slaby <jslaby@suse.cz>
      Cc: linux-serial@vger.kernel.org
      Cc: Jason Wessel <jason.wessel@windriver.com>
      Cc: kgdb-bugreport@lists.sourceforge.net
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      22077b09
    • L
      serial: 8250_fintek: Enable high speed mode on Fintek F81866 · fab8a02b
      Lukas Redlinger 提交于
      Fintek F81866 supports baud rates higher than 115200 but needs to raise
      it's clock speed from 1.84 to 14.76 MHz.
      This is eight times faster, so gives 921600 as resulting baud_base.
      
      F81866 clock register 0xf2:
          Bit 7-2    reserved
          Bit 1-0    00: 1.8432MHz
                     01: 18.432MHz
                     10: 24MHz
                     11: 14.769MHz
      Signed-off-by: NLukas Redlinger <rel+kernel@agilox.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      fab8a02b
    • P
      tty: Fix ldisc crash on reopened tty · 71472fa9
      Peter Hurley 提交于
      If the tty has been hungup, the ldisc instance may have been destroyed.
      Continued input to the tty will be ignored as long as the ldisc instance
      is not visible to the flush_to_ldisc kworker. However, when the tty
      is reopened and a new ldisc instance is created, the flush_to_ldisc
      kworker can obtain an ldisc reference before the new ldisc is
      completely initialized. This will likely crash:
      
       BUG: unable to handle kernel paging request at 0000000000002260
       IP: [<ffffffff8152dc5d>] n_tty_receive_buf_common+0x6d/0xb80
       PGD 2ab581067 PUD 290c11067 PMD 0
       Oops: 0000 [#1] PREEMPT SMP
       Modules linked in: nls_iso8859_1 ip6table_filter [.....]
       CPU: 2 PID: 103 Comm: kworker/u16:1 Not tainted 4.6.0-rc7+wip-xeon+debug #rc7+wip
       Hardware name: Dell Inc. Precision WorkStation T5400  /0RW203, BIOS A11 04/30/2012
       Workqueue: events_unbound flush_to_ldisc
       task: ffff8802ad16d100 ti: ffff8802ad31c000 task.ti: ffff8802ad31c000
       RIP: 0010:[<ffffffff8152dc5d>]  [<ffffffff8152dc5d>] n_tty_receive_buf_common+0x6d/0xb80
       RSP: 0018:ffff8802ad31fc70  EFLAGS: 00010296
       RAX: 0000000000000000 RBX: ffff8802aaddd800 RCX: 0000000000000001
       RDX: 00000000ffffffff RSI: ffffffff810db48f RDI: 0000000000000246
       RBP: ffff8802ad31fd08 R08: 0000000000000000 R09: 0000000000000001
       R10: ffff8802aadddb28 R11: 0000000000000001 R12: ffff8800ba6da808
       R13: ffff8802ad18be80 R14: ffff8800ba6da858 R15: ffff8800ba6da800
       FS:  0000000000000000(0000) GS:ffff8802b0a00000(0000) knlGS:0000000000000000
       CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
       CR2: 0000000000002260 CR3: 000000028ee5d000 CR4: 00000000000006e0
       Stack:
        ffffffff81531219 ffff8802aadddab8 ffff8802aadddde0 ffff8802aadddd78
        ffffffff00000001 ffff8800ba6da858 ffff8800ba6da860 ffff8802ad31fd30
        ffffffff81885f78 ffffffff81531219 0000000000000000 0000000200000000
       Call Trace:
        [<ffffffff81531219>] ? flush_to_ldisc+0x49/0xd0
        [<ffffffff81885f78>] ? mutex_lock_nested+0x2c8/0x430
        [<ffffffff81531219>] ? flush_to_ldisc+0x49/0xd0
        [<ffffffff8152e784>] n_tty_receive_buf2+0x14/0x20
        [<ffffffff81530cb2>] tty_ldisc_receive_buf+0x22/0x50
        [<ffffffff8153128e>] flush_to_ldisc+0xbe/0xd0
        [<ffffffff810a0ebd>] process_one_work+0x1ed/0x6e0
        [<ffffffff810a0e3f>] ? process_one_work+0x16f/0x6e0
        [<ffffffff810a13fe>] worker_thread+0x4e/0x490
        [<ffffffff810a13b0>] ? process_one_work+0x6e0/0x6e0
        [<ffffffff810a7ef2>] kthread+0xf2/0x110
        [<ffffffff810ae68c>] ? preempt_count_sub+0x4c/0x80
        [<ffffffff8188ab52>] ret_from_fork+0x22/0x50
        [<ffffffff810a7e00>] ? kthread_create_on_node+0x220/0x220
       Code: ff ff e8 27 a0 35 00 48 8d 83 78 05 00 00 c7 45 c0 00 00 00 00 48 89 45 80 48
             8d 83 e0 05 00 00 48 89 85 78 ff ff ff 48 8b 45 b8 <48> 8b b8 60 22 00 00 48
             8b 30 89 f8 8b 8b 88 04 00 00 29 f0 8d
       RIP  [<ffffffff8152dc5d>] n_tty_receive_buf_common+0x6d/0xb80
        RSP <ffff8802ad31fc70>
       CR2: 0000000000002260
      
      Ensure the kworker cannot obtain the ldisc reference until the new ldisc
      is completely initialized.
      
      Fixes: 892d1fa7 ("tty: Destroy ldisc instance on hangup")
      Reported-by: NMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: NPeter Hurley <peter@hurleysoftware.com>
      Signed-off-by: NMichael Neuling <mikey@neuling.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      71472fa9
    • W
      tty: pty: Fix ldisc flush after userspace become aware of the data already · 77dae613
      Wang YanQing 提交于
      While using emacs, cat or others' commands in konsole with recent
      kernels, I have met many times that CTRL-C freeze konsole. After
      konsole freeze I can't type anything, then I have to open a new one,
      it is very annoying.
      
      See bug report:
      https://bugs.kde.org/show_bug.cgi?id=175283
      
      The platform in that bug report is Solaris, but now the pty in linux
      has the same problem or the same behavior as Solaris :)
      
      It has high possibility to trigger the problem follow steps below:
      Note: In my test, BigFile is a text file whose size is bigger than 1G
      1:open konsole
      1:cat BigFile
      2:CTRL-C
      
      After some digging, I find out the reason is that commit 1d1d14da
      ("pty: Fix buffer flush deadlock") changes the behavior of pty_flush_buffer.
      
      Thread A                                 Thread B
      --------                                 --------
      1:n_tty_poll return POLLIN
                                               2:CTRL-C trigger pty_flush_buffer
                                                   tty_buffer_flush
                                                     n_tty_flush_buffer
      3:attempt to check count of chars:
        ioctl(fd, TIOCINQ, &available)
        available is equal to 0
      
      4:read(fd, buffer, avaiable)
        return 0
      
      5:konsole close fd
      
      Yes, I know we could use the same patch included in the BUG report as
      a workaround for linux platform too. But I think the data in ldisc is
      belong to application of another side, we shouldn't clear it when we
      want to flush write buffer of this side in pty_flush_buffer. So I think
      it is better to disable ldisc flush in pty_flush_buffer, because its new
      hehavior bring no benefit except that it mess up the behavior between
      POLLIN, and TIOCINQ or FIONREAD.
      
      Also I find no flush_buffer function in others' tty driver has the
      same behavior as current pty_flush_buffer.
      
      Fixes: 1d1d14da ("pty: Fix buffer flush deadlock")
      CC: stable@vger.kernel.org # v4.0+
      Signed-off-by: NWang YanQing <udknight@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      77dae613
    • S
      uartlite: Adding a kernel parameter for the number of uartlites · b44b96a0
      Sam Povilus 提交于
      The number of uartlites should be set by a kernel parameter instead of
      using a #define. This allows the user to set the number of uartlites
      using only kconfig and not modifying kernel source.
      
      The uartlite is used by FPGAs that support a basically unlimited number
      of uarts so limiting it at 16 dosn't make sense as users might need more
      than that.
      Signed-off-by: NSam Povilus <kernel.development@povil.us>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b44b96a0
    • S
      serial: xuartps: Cleanup the clock enable · 81e33b51
      Shubhrajyoti Datta 提交于
      The core handles the clocking now. Remove the clock disable in
      suspend. In resume we enable the clocks and disable after register
      write.
      Signed-off-by: NShubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      81e33b51
    • T
      serial: altera_jtaguart: add earlycon support · 0dcc0542
      Tobias Klauser 提交于
      Nios2 currently uses its own early printk implementation, rather than
      using unified earlycon support to show boot messages on altera_jtaguart
      (and altera_uart for that matter).
      
      Add earlycon support to altera_jtaguart so that other archs may use it. Also,
      this will allow the early printk implementation in arch/nios2 to eventually be
      removed in a future patch.
      
      Cc: Ley Foon Tan <lftan@altera.com>
      Signed-off-by: NTobias Klauser <tklauser@distanz.ch>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0dcc0542
    • T
      tty: n_gsm: Use net_device_stats from struct net_device · 47baf1ad
      Tobias Klauser 提交于
      Instead of using a private copy of struct net_device_stats in struct
      gsm_mux_net, use stats from struct net_device. Also remove
      the now unnecessary .ndo_get_stats function.
      Signed-off-by: NTobias Klauser <tklauser@distanz.ch>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      47baf1ad
    • J
      drivers/tty: Convert remaining uses of pr_warning to pr_warn · d437fa91
      Joe Perches 提交于
      To enable eventual removal of pr_warning
      
      This makes pr_warn use consistent for drivers/tty
      
      Prior to this patch, there were 2 uses of pr_warning and
      23 uses of pr_warn in drivers/tty
      Signed-off-by: NJoe Perches <joe@perches.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d437fa91
    • D
      tty: fix data race in tty_ldisc_ref_wait() · a4a3e061
      Dmitry Vyukov 提交于
      tty_ldisc_ref_wait() checks tty->ldisc under tty->ldisc_sem.
      But if ldisc==NULL it releases them sem and reloads
      tty->ldisc without holding the sem. This is wrong and
      can lead to returning non-NULL ldisc without protection.
      
      Don't reload tty->ldisc second time.
      Signed-off-by: NDmitry Vyukov <dvyukov@google.com>
      Cc: syzkaller@googlegroups.com
      Cc: linux-kernel@vger.kernel.org
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Jiri Slaby <jslaby@suse.com>
      Cc: Peter Hurley <peter@hurleysoftware.com>
      Cc: One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a4a3e061
    • D
      tty: don't panic on OOM in tty_set_ldisc() · 5362544b
      Dmitry Vyukov 提交于
      If tty_ldisc_open() fails in tty_set_ldisc(), it tries to go back
      to the old discipline or N_TTY. But that can fail as well, in such
      case it panics. This is not a graceful way to handle OOM.
      
      Leave ldisc==NULL if all attempts fail instead.
      Also use existing tty_ldisc_reinit() helper function instead of
      tty_ldisc_restore(). Also don't WARN/BUG in tty_ldisc_reinit()
      if N_TTY fails, which would have the same net effect of bringing
      kernel down on OOM. Instead print a single line message about
      what has happened.
      Signed-off-by: NDmitry Vyukov <dvyukov@google.com>
      Cc: syzkaller@googlegroups.com
      Cc: linux-kernel@vger.kernel.org
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Jiri Slaby <jslaby@suse.com>
      Cc: Peter Hurley <peter@hurleysoftware.com>
      Cc: One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5362544b
    • A
      Revert "tty: serial: pl011: add ttyAMA for matching pl011 console" · b767ad72
      Aleksey Makarov 提交于
      The original patch makes the condition always true, so it is wrong.
      
      It masks (but not fixes) the bug described in the commit message
      but introduces a regression (no console is selected by SPCR)
      in regular (no 'console=ttyAMA') case.
      
      s/||/&&/ would not fix the problem as the root cause was identified
      incorrectly.
      
      This reverts commit aea9a80b.
      Signed-off-by: NAleksey Makarov <aleksey.makarov@linaro.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Acked-by: NSudeep Holla <sudeep.holla@arm.com>
      Tested-by: NJayachandran C <jnair@caviumnetworks.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b767ad72
  4. 14 3月, 2017 12 次提交
  5. 08 3月, 2017 2 次提交
    • K
      serial: samsung: Continue to work if DMA request fails · f98c7bce
      Krzysztof Kozlowski 提交于
      If DMA is not available (even when configured in DeviceTree), the driver
      will fail the startup procedure thus making serial console not
      available.
      
      For example this causes boot failure on QEMU ARMv7 (Exynos4210, SMDKC210):
          [    1.302575] OF: amba_device_add() failed (-19) for /amba/pdma@12680000
          ...
          [   11.435732] samsung-uart 13800000.serial: DMA request failed
          [   72.963893] samsung-uart 13800000.serial: DMA request failed
          [   73.143361] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000000
      
      DMA is not necessary for serial to work, so continue with UART startup
      after emitting a warning.
      
      Fixes: 62c37eed ("serial: samsung: add dma reqest/release functions")
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NKrzysztof Kozlowski <krzk@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f98c7bce
    • A
      tty: n_hdlc: get rid of racy n_hdlc.tbuf · 82f2341c
      Alexander Popov 提交于
      Currently N_HDLC line discipline uses a self-made singly linked list for
      data buffers and has n_hdlc.tbuf pointer for buffer retransmitting after
      an error.
      
      The commit be10eb75
      ("tty: n_hdlc add buffer flushing") introduced racy access to n_hdlc.tbuf.
      After tx error concurrent flush_tx_queue() and n_hdlc_send_frames() can put
      one data buffer to tx_free_buf_list twice. That causes double free in
      n_hdlc_release().
      
      Let's use standard kernel linked list and get rid of n_hdlc.tbuf:
      in case of tx error put current data buffer after the head of tx_buf_list.
      Signed-off-by: NAlexander Popov <alex.popov@linux.com>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      82f2341c
  6. 02 3月, 2017 6 次提交
  7. 28 2月, 2017 2 次提交