lkml.org 
[lkml]   [2003]   [Jan]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: any chance of 2.6.0-test*?
> --- linux-2.5.56-work/drivers/char/tty_io.c-o	2003-01-02 05:13:12.000000000 +0100
> +++ linux-2.5.56-work/drivers/char/tty_io.c 2003-01-11 13:23:15.000000000 +0100
> @@ -1329,6 +1329,8 @@
> int major, minor;
> struct tty_driver *driver;
>
> + lock_kernel();
> +

Deadlock. chrdev_open() calls lock_kernel() and then the fops->open
method, which is tty_open().

> /* find a device that is not in use. */
> retval = -1;
> for ( major = 0 ; major < UNIX98_NR_MAJORS ; major++ ) {
> @@ -1340,6 +1342,8 @@
> if (!init_dev(device, &tty)) goto ptmx_found; /* ok! */
> }
> }
> +
> + unlock_kernel();
> return -EIO; /* no free ptys */
> ptmx_found:
> set_bit(TTY_PTY_LOCK, &tty->flags); /* LOCK THE SLAVE */
> @@ -1357,6 +1361,8 @@
> #endif /* CONFIG_UNIX_98_PTYS */
> }
>
> + lock_kernel();
> +

Deadlock. See chrdev_open() note above.

> retval = init_dev(device, &tty);
> if (retval)
> return retval;
> @@ -1389,6 +1395,8 @@
> #endif
>
> release_dev(filp);
> +
> + unlock_kernel();
> if (retval != -ERESTARTSYS)
> return retval;
> if (signal_pending(current))
> @@ -1397,6 +1405,7 @@
> /*
> * Need to reset f_op in case a hangup happened.
> */
> + lock_kernel();

Deadlock. See chrdev_open() note above.

> filp->f_op = &tty_fops;
> goto retry_open;
> }
> @@ -1424,6 +1433,7 @@
> nr_warns++;
> }
> }
> + unlock_kernel();
> return 0;
> }
>
> @@ -1444,8 +1454,13 @@
> if (tty_paranoia_check(tty, filp->f_dentry->d_inode->i_rdev, "tty_poll"))
> return 0;
>
> - if (tty->ldisc.poll)
> - return (tty->ldisc.poll)(tty, filp, wait);
> + if (tty->ldisc.poll) {
> + int ret;
> + lock_kernel();
> + ret = (tty->ldisc.poll)(tty, filp, wait);
> + unlock_kernel();
> + return ret;
> + }

This one needs deeper review.

--
Russell King (rmk@arm.linux.org.uk) The developer of ARM Linux
http://www.arm.linux.org.uk/personal/aboutme.html

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:32    [from the cache]
©2003-2011 Jasper Spaans