1. 22 9月, 2012 1 次提交
  2. 17 8月, 2012 1 次提交
  3. 14 8月, 2012 1 次提交
  4. 11 8月, 2012 2 次提交
  5. 28 7月, 2012 1 次提交
    • A
      tty: Fix race in tty release · d155255a
      Alan Cox 提交于
      Ian Abbott found that the tty layer would explode with the right set of
      parallel open and close operations. This is because we race in the
      handling of tty->drivers->termios[].
      
      Correct this by
      	Making tty_ldisc_release behave like nromal code (takes the lock,
      			does stuff, drops the lock)
      	Drop the tty lock earlier in tty_ldisc_release
      	Taking the tty mutex around the driver->termios update in all cases
      	Adding a WARN_ON to catch future screwups.
      
      I also forgot to clean up the pty resources properly. With a pty pair we
      need to pull both halves out of the tables.
      Signed-off-by: NAlan Cox <alan@linux.intel.com>
      Tested-by: NIan Abbott <abbotti@mev.co.uk>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d155255a
  6. 18 7月, 2012 1 次提交
  7. 17 7月, 2012 2 次提交
  8. 13 7月, 2012 1 次提交
  9. 07 7月, 2012 1 次提交
    • A
      tty: localise the lock · f5e3bcc5
      Alan Cox 提交于
      The termios and other changes mean the other protections needed on the driver
      tty arrays should be adequate. Turn it all back on.
      
      This contains pieces folded in from the fixes made to the original patches
      
      | From: Geert Uytterhoeven <geert@linux-m68k.org>	(fix m68k)
      | From: Paul Gortmaker <paul.gortmaker@windriver.com>	(fix cris)
      | From: Jiri Kosina <jkosina@suze.cz>			(lockdep)
      | From: Eric Dumazet <eric.dumazet@gmail.com>		(lockdep)
      Signed-off-by: NAlan Cox <alan@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f5e3bcc5
  10. 14 6月, 2012 3 次提交
    • J
      PTY: add tty_port · d03702a2
      Jiri Slaby 提交于
      This has *no* function in the PTY driver yet. However as the tty
      buffers will move to the tty_port structure, we will need tty_port for
      all TTYs in the system, PTY inclusive.
      
      For PTYs this is ensured by allocating 2 tty_port's in pty_install,
      i.e. where the tty->link is allocated. Both tty_port's are properly
      assigned to each end of the tty.
      
      Freeing is done at the same place where tty is freed, i.e. in
      tty->ops->cleanup.
      
      This means BTW that tty_port does not outlive TTY in PTY. This might
      be a subject to change in the future if we see some problems.
      Signed-off-by: NJiri Slaby <jslaby@suse.cz>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d03702a2
    • J
      PTY: merge pty_install implementations · 5d249bc6
      Jiri Slaby 提交于
      There are currently two instances of code which handles PTY install.
      One for the legacy BSD PTY's, one for unix98's PTY's. Both of them are
      very similar and differ only in termios allocation and handling.
      
      Since we will need to allocate a tty_port at that place, this would
      require editing two places with the same pattern. Instead, let us move
      the implementation to one common place and call it from both places.
      Signed-off-by: NJiri Slaby <jslaby@suse.cz>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5d249bc6
    • J
      PTY: remove one empty ops->remove · 7171604a
      Jiri Slaby 提交于
      Currently, there are two as a left-over from previous patches.
      Although we really need to provide an empty handler, we do not need
      two. So remove one of them.
      Signed-off-by: NJiri Slaby <jslaby@suse.cz>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7171604a
  11. 03 6月, 2012 1 次提交
    • L
      tty: Revert the tty locking series, it needs more work · f309532b
      Linus Torvalds 提交于
      This reverts the tty layer change to use per-tty locking, because it's
      not correct yet, and fixing it will require some more deep surgery.
      
      The main revert is d29f3ef3 ("tty_lock: Localise the lock"), but
      there are several smaller commits that built upon it, they also get
      reverted here. The list of reverted commits is:
      
        fde86d31 - tty: add lockdep annotations
        8f6576ad - tty: fix ldisc lock inversion trace
        d3ca8b64 - pty: Fix lock inversion
        b1d679af - tty: drop the pty lock during hangup
        abcefe5f - tty/amiserial: Add missing argument for tty_unlock()
        fd11b42e - cris: fix missing tty arg in wait_event_interruptible_tty call
        d29f3ef3 - tty_lock: Localise the lock
      
      The revert had a trivial conflict in the 68360serial.c staging driver
      that got removed in the meantime.
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      f309532b
  12. 30 5月, 2012 1 次提交
  13. 10 5月, 2012 1 次提交
  14. 05 5月, 2012 2 次提交
  15. 29 3月, 2012 1 次提交
  16. 09 3月, 2012 1 次提交
  17. 25 2月, 2012 2 次提交
  18. 03 2月, 2012 2 次提交
  19. 25 1月, 2012 2 次提交
  20. 18 11月, 2011 1 次提交
  21. 19 10月, 2011 2 次提交
    • J
      TTY: pty, release tty in all ptmx_open fail paths · 1177c0ef
      Jiri Slaby 提交于
      Mistakenly, commit 64ba3dc3 (tty: never hold BTM while getting
      tty_mutex) switched one fail path in ptmx_open to not free the newly
      allocated tty.
      
      Fix that by jumping to the appropriate place. And rename the labels so
      that it's clear what is going on there.
      
      Introduced-in: v2.6.36-rc2
      Signed-off-by: NJiri Slaby <jslaby@suse.cz>
      Cc: stable <stable@vger.kernel.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      1177c0ef
    • J
      TTY: make tty_add_file non-failing · fa90e1c9
      Jiri Slaby 提交于
      If tty_add_file fails at the point it is now, we have to revert all
      the changes we did to the tty. It means either decrease all refcounts
      if this was a tty reopen or delete the tty if it was newly allocated.
      
      There was a try to fix this in v3.0-rc2 using tty_release in 0259894c
      (TTY: fix fail path in tty_open). But instead it introduced a NULL
      dereference. It's because tty_release dereferences
      filp->private_data, but that one is set even in our tty_add_file. And
      when tty_add_file fails, it's still NULL/garbage. Hence tty_release
      cannot be called there.
      
      To circumvent the original leak (and the current NULL deref) we split
      tty_add_file into two functions, making the latter non-failing. In
      that case we may do the former early in open, where handling failures
      is easy. The latter stays as it is now. So there is no change in
      functionality.
      
      The original bug (leak) was introduced by f573bd17 (tty: Remove
      __GFP_NOFAIL from tty_add_file()). Thanks Dan for reporting this.
      
      Later, we may split tty_release into more functions and call only some
      of them in this fail path instead. (If at all possible.)
      
      Introduced-in: v2.6.37-rc2
      Signed-off-by: NJiri Slaby <jslaby@suse.cz>
      Reported-by: NDan Carpenter <dan.carpenter@oracle.com>
      Cc: stable <stable@vger.kernel.org>
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      Cc: Pekka Enberg <penberg@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      fa90e1c9
  22. 24 8月, 2011 1 次提交
    • J
      TTY: pty, fix pty counting · 24d406a6
      Jiri Slaby 提交于
      tty_operations->remove is normally called like:
      queue_release_one_tty
       ->tty_shutdown
         ->tty_driver_remove_tty
           ->tty_operations->remove
      
      However tty_shutdown() is called from queue_release_one_tty() only if
      tty_operations->shutdown is NULL. But for pty, it is not.
      pty_unix98_shutdown() is used there as ->shutdown.
      
      So tty_operations->remove of pty (i.e. pty_unix98_remove()) is never
      called. This results in invalid pty_count. I.e. what can be seen in
      /proc/sys/kernel/pty/nr.
      
      I see this was already reported at:
        https://lkml.org/lkml/2009/11/5/370
      But it was not fixed since then.
      
      This patch is kind of a hackish way. The problem lies in ->install. We
      allocate there another tty (so-called tty->link). So ->install is
      called once, but ->remove twice, for both tty and tty->link. The fix
      here is to count both tty and tty->link and divide the count by 2 for
      user.
      
      And to have ->remove called, let's make tty_driver_remove_tty() global
      and call that from pty_unix98_shutdown() (tty_operations->shutdown).
      
      While at it, let's document that when ->shutdown is defined,
      tty_shutdown() is not called.
      Signed-off-by: NJiri Slaby <jslaby@suse.cz>
      Cc: Alan Cox <alan@linux.intel.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: stable <stable@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      24d406a6
  23. 20 4月, 2011 4 次提交
  24. 02 3月, 2011 1 次提交
  25. 18 2月, 2011 1 次提交
  26. 05 11月, 2010 1 次提交
  27. 23 10月, 2010 1 次提交
  28. 18 8月, 2010 1 次提交
    • N
      tty: fix fu_list abuse · d996b62a
      Nick Piggin 提交于
      tty: fix fu_list abuse
      
      tty code abuses fu_list, which causes a bug in remount,ro handling.
      
      If a tty device node is opened on a filesystem, then the last link to the inode
      removed, the filesystem will be allowed to be remounted readonly. This is
      because fs_may_remount_ro does not find the 0 link tty inode on the file sb
      list (because the tty code incorrectly removed it to use for its own purpose).
      This can result in a filesystem with errors after it is marked "clean".
      
      Taking idea from Christoph's initial patch, allocate a tty private struct
      at file->private_data and put our required list fields in there, linking
      file and tty. This makes tty nodes behave the same way as other device nodes
      and avoid meddling with the vfs, and avoids this bug.
      
      The error handling is not trivial in the tty code, so for this bugfix, I take
      the simple approach of using __GFP_NOFAIL and don't worry about memory errors.
      This is not a problem because our allocator doesn't fail small allocs as a rule
      anyway. So proper error handling is left as an exercise for tty hackers.
      
      [ Arguably filesystem's device inode would ideally be divorced from the
      driver's pseudo inode when it is opened, but in practice it's not clear whether
      that will ever be worth implementing. ]
      
      Cc: linux-kernel@vger.kernel.org
      Cc: Christoph Hellwig <hch@infradead.org>
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      Cc: Greg Kroah-Hartman <gregkh@suse.de>
      Signed-off-by: NNick Piggin <npiggin@kernel.dk>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      d996b62a