lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Tue, 21 May 2013 13:57:37 +0400 (MSK)
From:	"Matwey V. Kornilov" <matwey@....msu.ru>
To:	jirislaby@...il.com
cc:	linux-serial@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] tty: mxser: fix usage of opmode_ioaddr

From: Matwey V. Kornilov <matwey@....msu.ru>

mxser_port->opmode_ioaddr is initialized only for MOXA_MUST_MU860_HWID 
chips, but no precautions have been undertaken to prevent reading and 
writing to undefined port number.

Signed-off-by: Matwey V. Kornilov <matwey@....msu.ru>
---

diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c
index 71d6eb2..f97b196 100644
--- a/drivers/tty/mxser.c
+++ b/drivers/tty/mxser.c
@@ -1618,8 +1618,12 @@ static int mxser_ioctl_special(unsigned int cmd, void __user *argp)
  				if (ip->type == PORT_16550A)
  					me->fifo[p] = 1;

-				opmode = inb(ip->opmode_ioaddr)>>((p % 4) * 2);
-				opmode &= OP_MODE_MASK;
+				if (ip->board->chip_flag == MOXA_MUST_MU860_HWID) {
+					opmode = inb(ip->opmode_ioaddr)>>((p % 4) * 2);
+					opmode &= OP_MODE_MASK;
+				} else {
+					opmode = RS232_MODE;
+				}
  				me->iftype[p] = opmode;
  				mutex_unlock(&port->mutex);
  			}
@@ -1670,6 +1674,9 @@ static int mxser_ioctl(struct tty_struct *tty,
  		return mxser_ioctl_special(cmd, argp);

  	if (cmd == MOXA_SET_OP_MODE || cmd == MOXA_GET_OP_MODE) {
+		if (info->board->chip_flag != MOXA_MUST_MU860_HWID)
+			return -EFAULT;
+
  		int p;
  		unsigned long opmode;
  		static unsigned char ModeMask[] = { 0xfc, 0xf3, 0xcf, 0x3f };
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ