1. 19 3月, 2013 1 次提交
  2. 14 2月, 2013 1 次提交
    • G
      pps: Move timestamp read into PPS code proper · 593fb1ae
      George Spelvin 提交于
      The PPS (Pulse-Per-Second) line discipline has developed a number of
      unhealthy attachments to core tty data and functions, ultimately leading
      to its breakage.
      
      The previous patches fixed the crashing.  This one reduces coupling further
      by eliminating the timestamp parameter from the dcd_change ldisc method.
      This reduces header file linkage and makes the extension more generic,
      and the timestamp read is delayed only slightly, from just before the
      ldisc->ops->dcd_change method call to just after.
      
      Fix attendant build breakage in
          drivers/tty/n_tty.c
          drivers/tty/tty_buffer.c
          drivers/staging/speakup/selection.c
          drivers/staging/dgrp/dgrp_*.c
      
      Cc: William Hubbs <w.d.hubbs@gmail.com>
      Cc: Chris Brannon <chris@the-brannons.com>
      Cc: Kirk Reiser <kirk@braille.uwo.ca>
      Cc: Samuel Thibault <samuel.thibault@ens-lyon.org>
      Signed-off-by: NPeter Hurley <peter@hurleysoftware.com>
      Signed-off-by: NGeorge Spelvin <linux@horizon.com>
      Acked-by: NRodolfo Giometti <giometti@enneenne.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      593fb1ae
  3. 05 2月, 2013 1 次提交
  4. 30 1月, 2013 1 次提交
  5. 26 1月, 2013 1 次提交
  6. 26 10月, 2012 1 次提交
  7. 23 10月, 2012 10 次提交
  8. 17 8月, 2012 1 次提交
  9. 11 8月, 2012 2 次提交
  10. 17 7月, 2012 1 次提交
  11. 27 6月, 2012 1 次提交
  12. 30 4月, 2012 1 次提交
    • J
      TTY: n_tty, do not dereference user buffer · 3fa10cc8
      Jiri Slaby 提交于
      copy_from_read_buf currently copies data to a user buffer and then
      checks if the data is single EOF. But it checks it by accessing the
      user buffer. First, the buffer may be changed by other threads of the
      user program already. Second, it accesses the buffer without any
      checks. It might be write-only for example.
      
      Fix this by inspecting contents of the tty (kernel) buffer instead.
      Note that "n == 1" is necessary, but not sufficient. But we check
      later that there is nothing left by "!tty->read_cnt" condition.
      
      There is still an issue with the current code that EOF being wrapped
      to the start of the circular buffer will result in an inappropriate
      losing of the EOF character. But this is not intended to be fixed by
      this patch.
      Signed-off-by: NJiri Slaby <jslaby@suse.cz>
      Reported-by: NEmil Goode <emilgoode@gmail.com>
      Cc: Howard Chu <hyc@symas.com>
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3fa10cc8
  13. 29 3月, 2012 1 次提交
  14. 10 12月, 2011 1 次提交
  15. 02 7月, 2011 1 次提交
    • A
      tty: fix "IRQ45: nobody cared" · 7b292b4b
      Andrew McGregor 提交于
      Unthrottling the TTY during close ends up enabling interrupts
      on a device not on the active list, which will never have the
      interrupts cleared.  Doctor, it hurts when I do this.
      
      >>> On 6/2/2011 at 01:56 AM, in message <20110601145608.3e586e16@bob.linux.org.uk>, Alan Cox <alan@linux.intel.com> wrote:
      > On Wed, 01 Jun 2011 10:34:07 +1200
      > "andrew mcgregor" <andrew.mcgregor@alliedtelesis.co.nz> wrote:
      > > The LKML message
      > > http://kerneltrap.org/mailarchive/linux-kernel/2010/2/25/4541847 from
      > > February doesn't seem to have been resolved since.  We struck the
      > > issue, and the patch below (against 2.6.32) fixes it.  Should I
      > > supply a patch against 3.0.0rc?
      >
      > I think that would be sensible. I don't actually see how you hit it as
      > the IRQ ought to be masked by then but it's certainly wrong for n_tty
      > to be calling into check_unthrottle at that point.
      >
      > So yes please send a patch with a suitable Signed-off-by: line to
      > linux-serial and cc GregKH <greg@kroah.com> as well.
      >
      > Alan
      Signed-off-by: NAndrew McGregor <andrew.mcgregor@alliedtelesis.co.nz>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      7b292b4b
  16. 08 6月, 2011 1 次提交
  17. 04 6月, 2011 1 次提交
    • L
      Revert "tty: make receive_buf() return the amout of bytes received" · 55db4c64
      Linus Torvalds 提交于
      This reverts commit b1c43f82.
      
      It was broken in so many ways, and results in random odd pty issues.
      
      It re-introduced the buggy schedule_work() in flush_to_ldisc() that can
      cause endless work-loops (see commit a5660b41: "tty: fix endless
      work loop when the buffer fills up").
      
      It also used an "unsigned int" return value fo the ->receive_buf()
      function, but then made multiple functions return a negative error code,
      and didn't actually check for the error in the caller.
      
      And it didn't actually work at all.  BenH bisected down odd tty behavior
      to it:
        "It looks like the patch is causing some major malfunctions of the X
         server for me, possibly related to PTYs.  For example, cat'ing a
         large file in a gnome terminal hangs the kernel for -minutes- in a
         loop of what looks like flush_to_ldisc/workqueue code, (some ftrace
         data in the quoted bits further down).
      
         ...
      
         Some more data: It -looks- like what happens is that the
         flush_to_ldisc work queue entry constantly re-queues itself (because
         the PTY is full ?) and the workqueue thread will basically loop
         forver calling it without ever scheduling, thus starving the consumer
         process that could have emptied the PTY."
      
      which is pretty much exactly the problem we fixed in a5660b41.
      
      Milton Miller pointed out the 'unsigned int' issue.
      Reported-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Reported-by: NMilton Miller <miltonm@bga.com>
      Cc: Stefan Bigler <stefan.bigler@keymile.com>
      Cc: Toby Gray <toby.gray@realvnc.com>
      Cc: Felipe Balbi <balbi@ti.com>
      Cc: Greg Kroah-Hartman <gregkh@suse.de>
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      55db4c64
  18. 23 4月, 2011 1 次提交
  19. 05 4月, 2011 1 次提交
    • L
      tty: fix endless work loop when the buffer fills up · a5660b41
      Linus Torvalds 提交于
      Commit f23eb2b2 ('tty: stop using "delayed_work" in the tty layer')
      ended up causing hung machines on UP with no preemption, because the
      work routine to flip the buffer data to the ldisc would endlessly re-arm
      itself if the destination buffer had filled up.
      
      With the delayed work, that only caused a timer-driving polling of the
      tty state every timer tick, but without the delay we just ended up with
      basically a busy loop instead.
      
      Stop the insane polling, and instead make the code that opens up the
      receive room re-schedule the buffer flip work.  That's what we should
      have been doing anyway.
      
      This same "poll for tty room" issue is almost certainly also the cause
      of excessive kworker activity when idle reported by Dave Jones, who also
      reported "flush_to_ldisc executing 2500 times a second" back in Nov 2010:
      
        http://lkml.org/lkml/2010/11/30/592
      
      which is that silly flushing done every timer tick.  Wasting both power
      and CPU for no good reason.
      Reported-and-tested-by: NAlexander Beregalov <a.beregalov@gmail.com>
      Reported-and-tested-by: NSitsofe Wheeler <sitsofe@yahoo.com>
      Cc: Greg KH <gregkh@suse.de>
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      Cc: Dave Jones <davej@redhat.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      a5660b41
  20. 05 11月, 2010 1 次提交
  21. 11 8月, 2010 1 次提交
    • H
      tty: Add EXTPROC support for LINEMODE · 26df6d13
      hyc@symas.com 提交于
      This patch is against the 2.6.34 source.
      
      Paraphrased from the 1989 BSD patch by David Borman @ cray.com:
      
           These are the changes needed for the kernel to support
           LINEMODE in the server.
      
           There is a new bit in the termios local flag word, EXTPROC.
           When this bit is set, several aspects of the terminal driver
           are disabled.  Input line editing, character echo, and mapping
           of signals are all disabled.  This allows the telnetd to turn
           off these functions when in linemode, but still keep track of
           what state the user wants the terminal to be in.
      
           New ioctl:
               TIOCSIG         Generate a signal to processes in the
                               current process group of the pty.
      
           There is a new mode for packet driver, the TIOCPKT_IOCTL bit.
           When packet mode is turned on in the pty, and the EXTPROC bit
           is set, then whenever the state of the pty is changed, the
           next read on the master side of the pty will have the TIOCPKT_IOCTL
           bit set.  This allows the process on the server side of the pty
           to know when the state of the terminal has changed; it can then
           issue the appropriate ioctl to retrieve the new state.
      
      Since the original BSD patches accompanied the source code for telnet
      I've left that reference here, but obviously the feature is useful for
      any remote terminal protocol, including ssh.
      
      The corresponding feature has existed in the BSD tty driver since 1989.
      For historical reference, a good copy of the relevant files can be found
      here:
      
      http://anonsvn.mit.edu/viewvc/krb5/trunk/src/appl/telnet/?pathrev=17741Signed-off-by: NHoward Chu <hyc@symas.com>
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      
      26df6d13
  22. 13 3月, 2010 1 次提交
  23. 20 9月, 2009 2 次提交
  24. 06 9月, 2009 1 次提交
    • L
      n_tty: do O_ONLCR translation as a single write · 37f81fa1
      Linus Torvalds 提交于
      When translating CR to CRNL in the n_tty line discipline, we did it as
      two tty_put_char() calls.  Which works, but is stupid, and has caused
      problems before too with bad interactions with the write_room() logic.
      The generic USB serial driver had that problem, for example.
      
      Now the pty layer had similar issues after being moved to the generic
      tty buffering code (in commit d945cb9c:
      "pty: Rework the pty layer to use the normal buffering logic").
      
      So stop doing the silly separate two writes, and do it as a single write
      instead.  That's what the n_tty layer already does for the space
      expansion of tabs (XTABS), and it means that we'll now always have just
      a single write for the CRNL to match the single 'tty_write_room()' test,
      which hopefully means that the next time somebody screws up buffering,
      it won't cause weeks of debugging.
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      37f81fa1
  25. 30 7月, 2009 1 次提交
    • O
      pty: avoid forcing 'low_latency' tty flag · e043e42b
      OGAWA Hirofumi 提交于
      We really don't want to mark the pty as a low-latency device, because as
      Alan points out, the ->write method can be called from an IRQ (ppp?),
      and that means we can't use ->low_latency=1 as we take mutexes in the
      low_latency case.
      
      So rather than using low_latency to force the written data to be pushed
      to the ldisc handling at 'write()' time, just make the reader side (or
      the poll function) do the flush when it checks whether there is data to
      be had.
      
      This also fixes the problem with lost data in an emacs compile buffer
      (bugzilla 13815), and we can thus revert the low_latency pty hack
      (commit 3a542974: "pty: quickfix for the
      pty ENXIO timing problems").
      Signed-off-by: NOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
      Tested-by: NAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
      [ Modified to do the tty_flush_to_ldisc() inside input_available_p() so
        that it triggers for both read and poll()  - Linus]
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      e043e42b
  26. 17 7月, 2009 1 次提交
    • A
      n_tty: Fix echo race · 80770884
      Alan Cox 提交于
      If a tty in N_TTY mode with echo enabled manages to get itself into a state
      where
      	- echo characters are pending
      	- FASYNC is enabled
      	- tty_write_wakeup is called from either
      		- a device write path (pty)
      		- an IRQ (serial)
      
      then it either deadlocks or explodes taking a mutex in the IRQ path.
      
      On the serial side it is almost impossible to reproduce because you have to
      go from a full serial port to a near empty one with echo characters
      pending. The pty case happens to have become possible to trigger using
      emacs and ptys, the pty changes having created a scenario which shows up
      this bug.
      
      The code path is
      
      	n_tty:process_echoes() (takes mutex)
      	tty_io:tty_put_char()
      	pty:pty_write  (or serial paths)
      	tty_wakeup     (from pty_write or serial IRQ)
      	n_tty_write_wakeup()
      	process_echoes()
      	*KABOOM*
      Signed-off-by: NAlan Cox <alan@linux.intel.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      80770884
  27. 11 6月, 2009 2 次提交
  28. 03 1月, 2009 1 次提交