Commit 38ad2ed0 authored by Paul Fulghum's avatar Paul Fulghum Committed by Linus Torvalds

tty: restore locked ioctl file op

Restore tty locked ioctl handler which was replaced with
an unlocked ioctl handler in hung_up_tty_fops by the patch:

commit e10cc1df
Author: Paul Fulghum <paulkf@microgate.com>
Date:   Thu May 10 22:22:50 2007 -0700

    tty: add compat_ioctl

This was reported in:
[Bug 8473] New: Oops: 0010 [1] SMP

The bug is caused by switching to hung_up_tty_fops in do_tty_hangup.  An
ioctl call can be waiting on BLK after testing for existence of the locked
ioctl handler in the normal tty fops, but before calling the locked ioctl
handler.  If a hangup occurs at that point, the locked ioctl fop is NULL
and an oops occurs.

(akpm: we can remove my debugging code from do_ioctl() now, but it'll be OK to
do that for 2.6.23)
Signed-off-by: default avatarPaul Fulghum <paulkf@microgate.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent f4d27817
...@@ -1173,8 +1173,14 @@ static unsigned int hung_up_tty_poll(struct file * filp, poll_table * wait) ...@@ -1173,8 +1173,14 @@ static unsigned int hung_up_tty_poll(struct file * filp, poll_table * wait)
return POLLIN | POLLOUT | POLLERR | POLLHUP | POLLRDNORM | POLLWRNORM; return POLLIN | POLLOUT | POLLERR | POLLHUP | POLLRDNORM | POLLWRNORM;
} }
static long hung_up_tty_ioctl(struct file * file, static int hung_up_tty_ioctl(struct inode * inode, struct file * file,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{
return cmd == TIOCSPGRP ? -ENOTTY : -EIO;
}
static long hung_up_tty_compat_ioctl(struct file * file,
unsigned int cmd, unsigned long arg)
{ {
return cmd == TIOCSPGRP ? -ENOTTY : -EIO; return cmd == TIOCSPGRP ? -ENOTTY : -EIO;
} }
...@@ -1222,8 +1228,8 @@ static const struct file_operations hung_up_tty_fops = { ...@@ -1222,8 +1228,8 @@ static const struct file_operations hung_up_tty_fops = {
.read = hung_up_tty_read, .read = hung_up_tty_read,
.write = hung_up_tty_write, .write = hung_up_tty_write,
.poll = hung_up_tty_poll, .poll = hung_up_tty_poll,
.unlocked_ioctl = hung_up_tty_ioctl, .ioctl = hung_up_tty_ioctl,
.compat_ioctl = hung_up_tty_ioctl, .compat_ioctl = hung_up_tty_compat_ioctl,
.release = tty_release, .release = tty_release,
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment