* serial_core:recognize invalid pointer from userspace
@ 2016-03-09 8:02 Jiang Lu
2016-03-09 8:02 ` Jiang Lu
0 siblings, 1 reply; 3+ messages in thread
From: Jiang Lu @ 2016-03-09 8:02 UTC (permalink / raw)
To: warrick.jiang, linux-kernel, linux-serial
Hi,
When running setserial, application issue a TIOCGSERIAL iotcl to get serial setting, then update
serial setting with TIOCSSERIAL ioctl. It always failed with TIOCSSERIAL ioctl, for application
pass 0xffffffff for iomem_base in serial_struct to kernel.
On 32bit rootfs & 64bit kernel, compat_ioctl use 0xffffffff as a magic number to mark invalid pointer
for iomem_base in serial_struct when truncating a 64bit pointer into 32bit.
Serial driver need recognize this invalid pointer when parsing serial_struct from userspace.
Thanks
Jiang Lu
^ permalink raw reply [flat|nested] 3+ messages in thread
* serial_core:recognize invalid pointer from userspace
2016-03-09 8:02 serial_core:recognize invalid pointer from userspace Jiang Lu
@ 2016-03-09 8:02 ` Jiang Lu
2016-03-09 8:23 ` kbuild test robot
0 siblings, 1 reply; 3+ messages in thread
From: Jiang Lu @ 2016-03-09 8:02 UTC (permalink / raw)
To: warrick.jiang, linux-kernel, linux-serial
compat_ioctl use 0xffffffff as a magic number to mark invalid pointer
for iomem_base in serial_struct when truncating a 64bit pointer into
32bit.
Serial driver need recognize this invalid pointer when parsing
serial_struct from userspace.
Signed-off-by: Jiang Lu <lu.jiang@windriver.com>
---
drivers/tty/serial/serial_core.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index a5d545e..7b9ec1b 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -745,6 +745,9 @@ static int uart_set_info(struct tty_struct *tty, struct tty_port *port,
* allocations, we should treat type changes the same as
* IO port changes.
*/
+ if ((unsigned long)new_info->iomem_base == 0xffffffff)
+ new_info->iomem_base = (unsigned char *)uport->mapbase;
+
change_port = !(uport->flags & UPF_FIXED_PORT)
&& (new_port != uport->iobase ||
(unsigned long)new_info->iomem_base != uport->mapbase ||
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-03-09 8:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-09 8:02 serial_core:recognize invalid pointer from userspace Jiang Lu
2016-03-09 8:02 ` Jiang Lu
2016-03-09 8:23 ` kbuild test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox