Skip to contentSkip to conversation

Char: mxser, remove unnecessary tty test

PATCH New Jiri Slaby 1 participant 2 messages Sep 23, 2009

Subsystems (2)
lore
Share & tools
lore

Jiri Slaby

author
#0 lore raw

PATCH 1/2 Char: mxser, remove unnecessary tty test

Stanse found unnecessary test in mxser_startup.

tty is dereferenced earlier, the test is superfluous. Remove it.

---
 drivers/char/mxser.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
drivers/char/mxser.c +1 -2
index 5e28d39..859ffb3 100644
@@ -905,8 +905,7 @@ static int mxser_startup(struct tty_struct *tty)
 	if (inb(info->ioaddr + UART_LSR) == 0xff) {
 		spin_unlock_irqrestore(&info->slock, flags);
 		if (capable(CAP_SYS_ADMIN)) {
-			if (tty)
-				set_bit(TTY_IO_ERROR, &tty->flags);
+			set_bit(TTY_IO_ERROR, &tty->flags);
 			return 0;
 		} else
 			return -ENODEV;
Signature · 1 line
1.6.4.2
author
#1 lore raw

PATCH 2/2 Char: vt_ioctl, fix BKL imbalance

Stanse found (again) a BKL imbalance in vt_ioctl.

It's easily triggerable by ioctl(dev_tty_fd, VT_SETACTIVATE, NULL);

Introduced by "vt: add an activate and lock".

---
 drivers/char/vt_ioctl.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
drivers/char/vt_ioctl.c +4 -2
index 29c651a..6b36ee5 100644
@@ -981,8 +981,10 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
 			goto eperm;
 
 		if (copy_from_user(&vsa, (struct vt_setactivate __user *)arg,
-						sizeof(struct vt_setactivate)))
-			return -EFAULT;
+					sizeof(struct vt_setactivate))) {
+			ret = -EFAULT;
+			goto out;
+		}
 		if (vsa.console == 0 || vsa.console > MAX_NR_CONSOLES)
 			ret = -ENXIO;
 		else {
Signature · 1 line
1.6.4.2