aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/char/tty_ioctl.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/drivers/char/tty_ioctl.c b/drivers/char/tty_ioctl.c
index 30486df9fd3f..dee47f40c6a3 100644
--- a/drivers/char/tty_ioctl.c
+++ b/drivers/char/tty_ioctl.c
@@ -399,23 +399,27 @@ static int set_termios(struct tty_struct * tty, void __user *arg, int opt)
399 if (retval) 399 if (retval)
400 return retval; 400 return retval;
401 401
402 memcpy(&tmp_termios, tty->termios, sizeof(struct ktermios));
403
402 if (opt & TERMIOS_TERMIO) { 404 if (opt & TERMIOS_TERMIO) {
403 memcpy(&tmp_termios, tty->termios, sizeof(struct ktermios));
404 if (user_termio_to_kernel_termios(&tmp_termios, 405 if (user_termio_to_kernel_termios(&tmp_termios,
405 (struct termio __user *)arg)) 406 (struct termio __user *)arg))
406 return -EFAULT; 407 return -EFAULT;
407#ifdef TCGETS2 408#ifdef TCGETS2
408 } else if (opt & TERMIOS_OLD) { 409 } else if (opt & TERMIOS_OLD) {
409 memcpy(&tmp_termios, tty->termios, sizeof(struct termios));
410 if (user_termios_to_kernel_termios_1(&tmp_termios, 410 if (user_termios_to_kernel_termios_1(&tmp_termios,
411 (struct termios_v1 __user *)arg)) 411 (struct termios __user *)arg))
412 return -EFAULT; 412 return -EFAULT;
413#endif
414 } else { 413 } else {
415 if (user_termios_to_kernel_termios(&tmp_termios, 414 if (user_termios_to_kernel_termios(&tmp_termios,
416 (struct termios __user *)arg)) 415 (struct termios2 __user *)arg))
417 return -EFAULT; 416 return -EFAULT;
418 } 417 }
418#else
419 } else if (user_termios_to_kernel_termios(&tmp_termios,
420 (struct termios __user *)arg))
421 return -EFAULT;
422#endif
419 423
420 /* If old style Bfoo values are used then load c_ispeed/c_ospeed with the real speed 424 /* If old style Bfoo values are used then load c_ispeed/c_ospeed with the real speed
421 so its unconditionally usable */ 425 so its unconditionally usable */
@@ -707,11 +711,11 @@ int n_tty_ioctl(struct tty_struct * tty, struct file * file,
707 return 0; 711 return 0;
708#else 712#else
709 case TCGETS: 713 case TCGETS:
710 if (kernel_termios_to_user_termios_1((struct termios_v1 __user *)arg, real_tty->termios)) 714 if (kernel_termios_to_user_termios_1((struct termios __user *)arg, real_tty->termios))
711 return -EFAULT; 715 return -EFAULT;
712 return 0; 716 return 0;
713 case TCGETS2: 717 case TCGETS2:
714 if (kernel_termios_to_user_termios((struct termios __user *)arg, real_tty->termios)) 718 if (kernel_termios_to_user_termios((struct termios2 __user *)arg, real_tty->termios))
715 return -EFAULT; 719 return -EFAULT;
716 return 0; 720 return 0;
717 case TCSETSF2: 721 case TCSETSF2: