Commit a66639ab authored by Thomas Viehmann's avatar Thomas Viehmann Committed by Greg Kroah-Hartman

usb-serial: fix oti6858.c segfault in termios handling

The oti6858 usb serial driver should use kernel_termios_to_user_termios/
user_termios_to_kernel_termios to avoid segfaults because the kernel
uses a structure differing from that of user space with a different
size.
Signed-off-by: default avatarThomas Viehmann <tv@beamnet.de>
CC: stable <stable@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 0bd307e1
...@@ -818,19 +818,17 @@ static int oti6858_ioctl(struct usb_serial_port *port, struct file *file, ...@@ -818,19 +818,17 @@ static int oti6858_ioctl(struct usb_serial_port *port, struct file *file,
switch (cmd) { switch (cmd) {
case TCGETS: case TCGETS:
if (copy_to_user(user_arg, port->tty->termios, if (kernel_termios_to_user_termios((struct ktermios __user *)arg,
sizeof(struct ktermios))) { port->tty->termios))
return -EFAULT; return -EFAULT;
}
return 0; return 0;
case TCSETS: case TCSETS:
case TCSETSW: /* FIXME: this is not the same! */ case TCSETSW: /* FIXME: this is not the same! */
case TCSETSF: /* FIXME: this is not the same! */ case TCSETSF: /* FIXME: this is not the same! */
if (copy_from_user(port->tty->termios, user_arg, if (user_termios_to_kernel_termios(port->tty->termios,
sizeof(struct ktermios))) { (struct ktermios __user *)arg))
return -EFAULT; return -EFAULT;
}
oti6858_set_termios(port, NULL); oti6858_set_termios(port, NULL);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment