18 Nov, 2011

1 commit

  • Instead of the hackish way of counting ptys, let's define a specific
    ->remove hook both from slave and master. And decrease the count only
    for master.

    Signed-off-by: Jiri Slaby
    Cc: Alan Cox
    Signed-off-by: Greg Kroah-Hartman

    Jiri Slaby
     

26 Oct, 2011

1 commit

  • * 'tty-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: (79 commits)
    TTY: serial_core: Fix crash if DCD drop during suspend
    tty/serial: atmel_serial: bootconsole removed from auto-enumerates
    Revert "TTY: call tty_driver_lookup_tty unconditionally"
    tty/serial: atmel_serial: add device tree support
    tty/serial: atmel_serial: auto-enumerate ports
    tty/serial: atmel_serial: whitespace and braces modifications
    tty/serial: atmel_serial: change platform_data variable name
    tty/serial: RS485 bindings for device tree
    TTY: call tty_driver_lookup_tty unconditionally
    TTY: pty, release tty in all ptmx_open fail paths
    TTY: make tty_add_file non-failing
    TTY: drop driver reference in tty_open fail path
    8250_pci: Fix kernel panic when pch_uart is disabled
    h8300: drivers/serial/Kconfig was moved
    parport_pc: release IO region properly if unsupported ITE887x card is found
    tty: Support compat_ioctl get/set termios_locked
    hvc_console: display printk messages on console.
    TTY: snyclinkmp: forever loop in tx_load_dma_buffer()
    tty/n_gsm: avoid fifo overflow in gsm_dlci_data_output
    tty/n_gsm: fix a bug in gsm_dlci_data_output (adaption = 2 case)
    ...

    Fix up Conflicts in:
    - drivers/tty/serial/8250_pci.c
    Trivial conflict with removed duplicate device ID
    - drivers/tty/serial/atmel_serial.c
    Annoying silly conflict between "specify the port num via
    platform_data" and other changes to atmel_console_init

    Linus Torvalds
     

19 Oct, 2011

2 commits

  • Mistakenly, commit 64ba3dc3143d (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: Jiri Slaby
    Cc: stable
    Cc: Arnd Bergmann
    Cc: Alan Cox
    Signed-off-by: Greg Kroah-Hartman

    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 0259894c7
    (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 f573bd176 (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: Jiri Slaby
    Reported-by: Dan Carpenter
    Cc: stable
    Cc: Alan Cox
    Cc: Pekka Enberg
    Signed-off-by: Greg Kroah-Hartman

    Jiri Slaby
     

24 Aug, 2011

1 commit

  • 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: Jiri Slaby
    Cc: Alan Cox
    Cc: "H. Peter Anvin"
    Cc: stable
    Signed-off-by: Greg Kroah-Hartman

    Jiri Slaby
     

20 Apr, 2011

4 commits

  • remove invalid location line in each file header after location
    moved from driver/char to driver/tty

    Signed-off-by: Jovi Zhang
    Signed-off-by: Greg Kroah-Hartman

    Jovi Zhang
     
  • Used the newly introduced deinitialize_tty_struct to properly shut
    down ldisc.

    It is intended to fix the Julian's reported problem. He reports that
    kmemleak checker warns about memory leak:
    unreferenced object 0xc0e19860 (size 8):
    comm cat, pid 1226, jiffies 4294919464 (age 287.476s)
    hex dump (first 8 bytes):
    44 de 2d c1 01 00 00 00 D.-.....
    backtrace:
    [] create_object+0x109/0x1ad
    [] kmem_cache_alloc+0x60/0x68
    [] tty_ldisc_get+0x54/0x76
    [] tty_ldisc_init+0xa/0x20
    [] initialize_tty_struct+0x2d/0x1ac
    [] tty_init_dev+0x59/0x10d
    [] tty_open+0x24a/0x3a2
    ...

    Signed-off-by: Jiri Slaby
    Cc: Alan Cox
    Reported-by: Julian Anastasov
    Signed-off-by: Greg Kroah-Hartman

    Jiri Slaby
     
  • Change it so that we call the deinit functions at one place at the end
    of the function (by gotos). And while at it use some sane label names.

    This is a preparation for the deinitialization of tty in the next
    patch.

    Signed-off-by: Jiri Slaby
    Cc: Alan Cox
    Cc: Julian Anastasov
    Signed-off-by: Greg Kroah-Hartman

    Jiri Slaby
     
  • Change it so that we call the deinit functions at one place at the end
    of the function (by gotos). And while at it use some sane label names.

    This is a preparation for the deinitialization of tty in the next
    patch.

    Signed-off-by: Jiri Slaby
    Cc: Alan Cox
    Cc: Julian Anastasov
    Signed-off-by: Greg Kroah-Hartman

    Jiri Slaby
     

17 Mar, 2011

1 commit


02 Mar, 2011

1 commit


18 Feb, 2011

1 commit


05 Nov, 2010

1 commit