All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Fulghum <paulkf@microgate.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: "Björn Steinbrink" <B.Steinbrink@gmx.de>,
	"Arnd Bergmann" <arnd@arndb.de>,
	"Alan Cox" <alan@lxorguk.ukuu.org.uk>,
	"Nicolas Mailhot" <nicolas.mailhot@laposte.net>,
	"Randy Dunlap" <randy.dunlap@oracle.com>,
	"bugme-daemon@kernel-bugs.osdl.org"
	<bugme-daemon@bugzilla.kernel.org>,
	linux-kernel@vger.kernel.org, "Mel Gorman" <mel@csn.ul.ie>,
	"Christoph Lameter" <clameter@sgi.com>
Subject: [PATCH] tty restore locked ioctl file op
Date: Fri, 08 Jun 2007 15:34:17 -0500	[thread overview]
Message-ID: <1181334857.3408.0.camel@x2.microgate.com> (raw)
In-Reply-To: <20070608123350.5cc53c10.akpm@linux-foundation.org>

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

commit e10cc1df1d2014f68a4bdcf73f6dd122c4561f94
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.

Signed-off-by: Paul Fulghum <paulkf@microgate.com>

--- a/drivers/char/tty_io.c	2007-06-08 14:26:10.000000000 -0500
+++ b/drivers/char/tty_io.c	2007-06-08 14:28:58.000000000 -0500
@@ -1173,8 +1173,14 @@ static unsigned int hung_up_tty_poll(str
 	return POLLIN | POLLOUT | POLLERR | POLLHUP | POLLRDNORM | POLLWRNORM;
 }
 
-static long hung_up_tty_ioctl(struct file * file,
-			      unsigned int cmd, unsigned long arg)
+static int hung_up_tty_ioctl(struct inode * inode, struct file * file,
+			     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;
 }
@@ -1222,8 +1228,8 @@ static const struct file_operations hung
 	.read		= hung_up_tty_read,
 	.write		= hung_up_tty_write,
 	.poll		= hung_up_tty_poll,
-	.unlocked_ioctl = hung_up_tty_ioctl,
-	.compat_ioctl	= hung_up_tty_ioctl,
+	.ioctl		= hung_up_tty_ioctl,
+	.compat_ioctl	= hung_up_tty_compat_ioctl,
 	.release	= tty_release,
 };
 




  reply	other threads:[~2007-06-08 20:35 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200705132102.l4DL2onF003014@fire-2.osdl.org>
2007-05-13 22:47 ` [Bug 8473] New: Oops: 0010 [1] SMP Andrew Morton
2007-05-13 23:25   ` Nicolas Mailhot
2007-05-17 10:00     ` Nicolas Mailhot
2007-05-17 16:45       ` Randy Dunlap
2007-05-17 16:59         ` Nicolas Mailhot
2007-05-26 19:10           ` Nicolas Mailhot
2007-06-08  3:06             ` Björn Steinbrink
2007-06-08  3:16               ` Andrew Morton
2007-06-08 14:10                 ` Paul Fulghum
2007-06-08 15:16               ` Paul Fulghum
2007-06-08 19:20                 ` Paul Fulghum
2007-06-08 19:33                   ` Andrew Morton
2007-06-08 20:34                     ` Paul Fulghum [this message]
2007-06-09 18:18                       ` [PATCH] tty restore locked ioctl file op Björn Steinbrink
2007-06-09 21:52                         ` Paul Fulghum

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1181334857.3408.0.camel@x2.microgate.com \
    --to=paulkf@microgate.com \
    --cc=B.Steinbrink@gmx.de \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=arnd@arndb.de \
    --cc=bugme-daemon@bugzilla.kernel.org \
    --cc=clameter@sgi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mel@csn.ul.ie \
    --cc=nicolas.mailhot@laposte.net \
    --cc=randy.dunlap@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.