mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/2] Char: mxser, remove unnecessary tty test
@ 2009-09-23 14:13 Jiri Slaby
  2009-09-23 14:13 ` [PATCH 2/2] Char: vt_ioctl, fix BKL imbalance Jiri Slaby
  0 siblings, 1 reply; 2+ messages in thread
From: Jiri Slaby @ 2009-09-23 14:13 UTC (permalink / raw)
  To: gregkh; +Cc: akpm, linux-kernel, Jiri Slaby

Stanse found unnecessary test in mxser_startup.

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

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
---
 drivers/char/mxser.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/char/mxser.c b/drivers/char/mxser.c
index 5e28d39..859ffb3 100644
--- a/drivers/char/mxser.c
+++ b/drivers/char/mxser.c
@@ -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;
-- 
1.6.4.2


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH 2/2] Char: vt_ioctl, fix BKL imbalance
  2009-09-23 14:13 [PATCH 1/2] Char: mxser, remove unnecessary tty test Jiri Slaby
@ 2009-09-23 14:13 ` Jiri Slaby
  0 siblings, 0 replies; 2+ messages in thread
From: Jiri Slaby @ 2009-09-23 14:13 UTC (permalink / raw)
  To: gregkh; +Cc: akpm, linux-kernel, Jiri Slaby, Alan Cox

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".

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Cc: Alan Cox <alan@linux.intel.com>
---
 drivers/char/vt_ioctl.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/char/vt_ioctl.c b/drivers/char/vt_ioctl.c
index 29c651a..6b36ee5 100644
--- a/drivers/char/vt_ioctl.c
+++ b/drivers/char/vt_ioctl.c
@@ -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 {
-- 
1.6.4.2


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-09-23 14:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-23 14:13 [PATCH 1/2] Char: mxser, remove unnecessary tty test Jiri Slaby
2009-09-23 14:13 ` [PATCH 2/2] Char: vt_ioctl, fix BKL imbalance Jiri Slaby

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®