aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial/68328serial.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/serial/68328serial.c')
-rw-r--r--drivers/serial/68328serial.c29
1 files changed, 11 insertions, 18 deletions
diff --git a/drivers/serial/68328serial.c b/drivers/serial/68328serial.c
index 7356a56ac458..be0ebce36e54 100644
--- a/drivers/serial/68328serial.c
+++ b/drivers/serial/68328serial.c
@@ -869,7 +869,9 @@ static int get_serial_info(struct m68k_serial * info,
869 tmp.close_delay = info->close_delay; 869 tmp.close_delay = info->close_delay;
870 tmp.closing_wait = info->closing_wait; 870 tmp.closing_wait = info->closing_wait;
871 tmp.custom_divisor = info->custom_divisor; 871 tmp.custom_divisor = info->custom_divisor;
872 copy_to_user(retinfo,&tmp,sizeof(*retinfo)); 872 if (copy_to_user(retinfo, &tmp, sizeof(*retinfo)))
873 return -EFAULT;
874
873 return 0; 875 return 0;
874} 876}
875 877
@@ -882,7 +884,8 @@ static int set_serial_info(struct m68k_serial * info,
882 884
883 if (!new_info) 885 if (!new_info)
884 return -EFAULT; 886 return -EFAULT;
885 copy_from_user(&new_serial,new_info,sizeof(new_serial)); 887 if (copy_from_user(&new_serial, new_info, sizeof(new_serial)))
888 return -EFAULT;
886 old_info = *info; 889 old_info = *info;
887 890
888 if (!capable(CAP_SYS_ADMIN)) { 891 if (!capable(CAP_SYS_ADMIN)) {
@@ -943,8 +946,7 @@ static int get_lsr_info(struct m68k_serial * info, unsigned int *value)
943 status = 0; 946 status = 0;
944#endif 947#endif
945 local_irq_restore(flags); 948 local_irq_restore(flags);
946 put_user(status,value); 949 return put_user(status, value);
947 return 0;
948} 950}
949 951
950/* 952/*
@@ -999,27 +1001,18 @@ static int rs_ioctl(struct tty_struct *tty, struct file * file,
999 send_break(info, arg ? arg*(100) : 250); 1001 send_break(info, arg ? arg*(100) : 250);
1000 return 0; 1002 return 0;
1001 case TIOCGSERIAL: 1003 case TIOCGSERIAL:
1002 if (access_ok(VERIFY_WRITE, (void *) arg, 1004 return get_serial_info(info,
1003 sizeof(struct serial_struct))) 1005 (struct serial_struct *) arg);
1004 return get_serial_info(info,
1005 (struct serial_struct *) arg);
1006 return -EFAULT;
1007 case TIOCSSERIAL: 1006 case TIOCSSERIAL:
1008 return set_serial_info(info, 1007 return set_serial_info(info,
1009 (struct serial_struct *) arg); 1008 (struct serial_struct *) arg);
1010 case TIOCSERGETLSR: /* Get line status register */ 1009 case TIOCSERGETLSR: /* Get line status register */
1011 if (access_ok(VERIFY_WRITE, (void *) arg, 1010 return get_lsr_info(info, (unsigned int *) arg);
1012 sizeof(unsigned int)))
1013 return get_lsr_info(info, (unsigned int *) arg);
1014 return -EFAULT;
1015 case TIOCSERGSTRUCT: 1011 case TIOCSERGSTRUCT:
1016 if (!access_ok(VERIFY_WRITE, (void *) arg, 1012 if (copy_to_user((struct m68k_serial *) arg,
1017 sizeof(struct m68k_serial))) 1013 info, sizeof(struct m68k_serial)))
1018 return -EFAULT; 1014 return -EFAULT;
1019 copy_to_user((struct m68k_serial *) arg,
1020 info, sizeof(struct m68k_serial));
1021 return 0; 1015 return 0;
1022
1023 default: 1016 default:
1024 return -ENOIOCTLCMD; 1017 return -ENOIOCTLCMD;
1025 } 1018 }