21 May 2013 11:57
[PATCH] tty: mxser: fix usage of opmode_ioaddr
Matwey V. Kornilov <matwey <at> sai.msu.ru>
2013-05-21 09:57:37 GMT
2013-05-21 09:57:37 GMT
From: Matwey V. Kornilov <matwey <at> sai.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 <at> sai.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
<at> <at> -1618,8 +1618,12 <at> <at> 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);
}
<at> <at> -1670,6 +1674,9 <at> <at> static int mxser_ioctl(struct tty_struct *tty,
return mxser_ioctl_special(cmd, argp);
(Continue reading)
RSS Feed