[PATCH 1/1] tty: BKL pushdown fix

From: Jiri Slaby
Date: Fri Feb 08 2008 - 14:05:33 EST


Signed-off-by: Jiri Slaby <jirislaby@xxxxxxxxx>
---
drivers/char/n_hdlc.c | 4 ++--
drivers/char/n_r3964.c | 6 +++---
drivers/char/n_tty.c | 2 +-
drivers/char/tty_io.c | 16 +++++++++-------
drivers/char/vt.c | 8 ++++----
5 files changed, 19 insertions(+), 17 deletions(-)

diff --git a/drivers/char/n_hdlc.c b/drivers/char/n_hdlc.c
index 0bc0498..77629da 100644
--- a/drivers/char/n_hdlc.c
+++ b/drivers/char/n_hdlc.c
@@ -579,7 +579,7 @@ static ssize_t n_hdlc_tty_read(struct tty_struct *tty, struct file *file,
}

lock_kernel();
-
+
for (;;) {
if (test_bit(TTY_OTHER_CLOSED, &tty->flags)) {
unlock_kernel();
@@ -672,7 +672,7 @@ static ssize_t n_hdlc_tty_write(struct tty_struct *tty, struct file *file,
}

lock_kernel();
-
+
add_wait_queue(&tty->write_wait, &wait);
set_current_state(TASK_INTERRUPTIBLE);

diff --git a/drivers/char/n_r3964.c b/drivers/char/n_r3964.c
index 3eb7880..3f6486e 100644
--- a/drivers/char/n_r3964.c
+++ b/drivers/char/n_r3964.c
@@ -1074,7 +1074,7 @@ static ssize_t r3964_read(struct tty_struct *tty, struct file *file,
int count;

TRACE_L("read()");
-
+
lock_kernel();

pClient = findClient(pInfo, task_pid(current));
@@ -1165,7 +1165,7 @@ static ssize_t r3964_write(struct tty_struct *tty, struct file *file,
pHeader->owner = NULL;

lock_kernel();
-
+
pClient = findClient(pInfo, task_pid(current));
if (pClient) {
pHeader->owner = pClient;
@@ -1182,7 +1182,7 @@ static ssize_t r3964_write(struct tty_struct *tty, struct file *file,
*/
add_tx_queue(pInfo, pHeader);
trigger_transmit(pInfo);
-
+
unlock_kernel();

return 0;
diff --git a/drivers/char/n_tty.c b/drivers/char/n_tty.c
index a9c8c8f..79a052e 100644
--- a/drivers/char/n_tty.c
+++ b/drivers/char/n_tty.c
@@ -1303,7 +1303,7 @@ do_it_again:
return -ERESTARTSYS;
}
packet = tty->packet;
-
+
add_wait_queue(&tty->read_wait, &wait);
while (nr) {
/* First test for status change. */
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index 3d489ce..bf08a38 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -1204,8 +1204,8 @@ static unsigned int hung_up_tty_poll(struct file *filp, poll_table *wait)
return POLLIN | POLLOUT | POLLERR | POLLHUP | POLLRDNORM | POLLWRNORM;
}

-static long hung_up_tty_ioctl(struct inode *inode, struct file *file,
- unsigned int cmd, unsigned long arg)
+static long hung_up_tty_ioctl(struct file *file, unsigned int cmd,
+ unsigned long arg)
{
return cmd == TIOCSPGRP ? -ENOTTY : -EIO;
}
@@ -1259,7 +1259,7 @@ static const struct file_operations hung_up_tty_fops = {
.read = hung_up_tty_read,
.write = hung_up_tty_write,
.poll = hung_up_tty_poll,
- .ioctl = hung_up_tty_ioctl,
+ .unlocked_ioctl = hung_up_tty_ioctl,
.compat_ioctl = hung_up_tty_compat_ioctl,
.release = tty_release,
};
@@ -3208,10 +3208,12 @@ static int tiocsetd(struct tty_struct *tty, int __user *p)

if (get_user(ldisc, p))
return -EFAULT;
-
+
lock_kernel();
ret = tty_set_ldisc(tty, ldisc);
unlock_kernel();
+
+ return ret;
}

/**
@@ -3230,7 +3232,7 @@ static int tiocsetd(struct tty_struct *tty, int __user *p)
static int send_break(struct tty_struct *tty, unsigned int duration)
{
int retval = -EINTR;
-
+
lock_kernel();
if (tty_write_lock(tty, 0) < 0)
goto out;
@@ -3345,9 +3347,9 @@ long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
/*
* Break handling by driver
*/
-
+
retval = -EINVAL;
-
+
if (!tty->driver->break_ctl) {
switch (cmd) {
case TIOCSBRK:
diff --git a/drivers/char/vt.c b/drivers/char/vt.c
index d6a3a2a..a26d65b 100644
--- a/drivers/char/vt.c
+++ b/drivers/char/vt.c
@@ -2531,9 +2531,9 @@ int tioclinux(struct tty_struct *tty, unsigned long arg)
if (get_user(type, p))
return -EFAULT;
ret = 0;
-
+
lock_kernel();
-
+
switch (type)
{
case TIOCL_SETSEL:
@@ -2553,7 +2553,7 @@ int tioclinux(struct tty_struct *tty, unsigned long arg)
ret = sel_loadlut(p);
break;
case TIOCL_GETSHIFTSTATE:
-
+
/*
* Make it possible to react to Shift+Mousebutton.
* Note that 'shift_state' is an undocumented
@@ -3823,7 +3823,7 @@ static int con_font_get(struct vc_data *vc, struct console_font_op *op)
goto out;

c = (font.width+7)/8 * 32 * font.charcount;
-
+
if (op->data && font.charcount > op->charcount)
rc = -ENOSPC;
if (!(op->flags & KD_FONT_FLAG_OLD)) {
--
1.5.3.8

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