[lkml]   [2012]   [Feb]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    Patch in this message
    Subject[PATCH 1/1] TTY: fix PTY hangup vs close race
    Commit d3bda5298 (TTY: get rid of BTM around devpts_*) moved
    devpts_pty_kill out of BTM, but the BTM was not protecting only
    devpts_pty_kill, but also tty->link. Hence move the function back at
    this late stage until this gets resolved properly some time later.

    I was confused by tty_vhangup(tty->link) outside BTM. But inside of
    tty_vhangup, there is a check for tty == NULL. But we cannot add such
    a check here. We have to have the tty and free the devpts node...

    Signed-off-by: Jiri Slaby <>
    Reported-by: Sasha Levin <>

    Gee, I messed up Greg's address again...

    drivers/tty/pty.c | 3 ++-
    1 files changed, 2 insertions(+), 1 deletions(-)

    diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c
    index fa1bd2e..95037aa 100644
    --- a/drivers/tty/pty.c
    +++ b/drivers/tty/pty.c
    @@ -54,8 +54,9 @@ static void pty_close(struct tty_struct *tty, struct file *filp)
    if (tty->driver->subtype == PTY_TYPE_MASTER) {
    set_bit(TTY_OTHER_CLOSED, &tty->flags);
    - tty_unlock();
    + /* BTM protects tty->link here */
    + tty_unlock();

     \ /
      Last update: 2012-02-19 22:21    [W:0.028 / U:5.812 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site