[Bugme-new] [Bug 11234] New: kernel is deadlocked due to tty->termios_mutex locked twice in one procedure

bugme-daemon at bugzilla.kernel.org bugme-daemon at bugzilla.kernel.org
Sat Aug 2 12:07:59 PDT 2008


http://bugzilla.kernel.org/show_bug.cgi?id=11234

           Summary: kernel is deadlocked due to tty->termios_mutex locked
                    twice in one procedure
           Product: Drivers
           Version: 2.5
     KernelVersion: 2.6.26
          Platform: All
        OS/Version: Linux
              Tree: Mainline
            Status: NEW
          Severity: high
          Priority: P1
         Component: Console/Framebuffers
        AssignedTo: jsimmons at infradead.org
        ReportedBy: ckyoog at gmail.com


Latest working kernel version:2.6.25
Earliest failing kernel version:2.6.26
Distribution:Gentoo
Hardware Environment:
Software Environment:
Problem Description:
Function tiocswinsz in drivers/char/tty_io.c calls
mutex_lock(&tty->termios_mutex), 
then tiocswinsz calls vc_lock_resize with tty->driver_data as first argument
when tty->termios_mutex
is locking.

The latter(vc_lock_resize in drivers/char/vt.c) then calls vc_resize which
calls mutex_lock(&vc->vc_tty->termios_mutex).
vc is its first argument which is tty->driver_data. vc->vc_tty is the tty of
tty->driver_data, is also
the tty of tty->termios_mutex locked in tiocswinsz.

So the procedure is like this: tiocswinsz locks a mutex, and then calls another
function(vc_resize finally), the latter locks the same mutex, and, oops, kernel
is deadlocked then!

I saw the code vt.c under version 2.6.25, there was no
mutex_lock(&vc->vc_tty->termios_mutex) in vc_resize.
This is new in 2.6.26.


Steps to reproduce:
int fd = open ("/dev/tty0", O_RDWR);
strunct winsize ws;
ws.ws_col = col; /*different from current col*/
ws.ws_row = row; /*different from current row*/
ioctl(fd, TIOCSWINSZ, &ws);


-- 
Configure bugmail: http://bugzilla.kernel.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


More information about the Bugme-new mailing list