diff options
author | Thomas Viehmann <tv@beamnet.de> | 2007-07-25 04:21:21 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-08-22 17:27:48 -0400 |
commit | a66639ab286250fe66b960c34ac91d0b2ee58a79 (patch) | |
tree | 80eb5386a7b1446821a45d7e4cb607c647c83bd0 | |
parent | 0bd307e1b950e0aca1dbbc2b76f542f9c96b9a95 (diff) |
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: Thomas Viehmann <tv@beamnet.de>
CC: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/usb/serial/oti6858.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/usb/serial/oti6858.c b/drivers/usb/serial/oti6858.c index d7db71eca520..833ada47fc54 100644 --- a/drivers/usb/serial/oti6858.c +++ b/drivers/usb/serial/oti6858.c | |||
@@ -818,19 +818,17 @@ static int oti6858_ioctl(struct usb_serial_port *port, struct file *file, | |||
818 | 818 | ||
819 | switch (cmd) { | 819 | switch (cmd) { |
820 | case TCGETS: | 820 | case TCGETS: |
821 | if (copy_to_user(user_arg, port->tty->termios, | 821 | if (kernel_termios_to_user_termios((struct ktermios __user *)arg, |
822 | sizeof(struct ktermios))) { | 822 | port->tty->termios)) |
823 | return -EFAULT; | 823 | return -EFAULT; |
824 | } | ||
825 | return 0; | 824 | return 0; |
826 | 825 | ||
827 | case TCSETS: | 826 | case TCSETS: |
828 | case TCSETSW: /* FIXME: this is not the same! */ | 827 | case TCSETSW: /* FIXME: this is not the same! */ |
829 | case TCSETSF: /* FIXME: this is not the same! */ | 828 | case TCSETSF: /* FIXME: this is not the same! */ |
830 | if (copy_from_user(port->tty->termios, user_arg, | 829 | if (user_termios_to_kernel_termios(port->tty->termios, |
831 | sizeof(struct ktermios))) { | 830 | (struct ktermios __user *)arg)) |
832 | return -EFAULT; | 831 | return -EFAULT; |
833 | } | ||
834 | oti6858_set_termios(port, NULL); | 832 | oti6858_set_termios(port, NULL); |
835 | return 0; | 833 | return 0; |
836 | 834 | ||