aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/vt_ioctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/vt_ioctl.c')
-rw-r--r--drivers/char/vt_ioctl.c46
1 files changed, 44 insertions, 2 deletions
diff --git a/drivers/char/vt_ioctl.c b/drivers/char/vt_ioctl.c
index f69a8258095c..6c7384afff13 100644
--- a/drivers/char/vt_ioctl.c
+++ b/drivers/char/vt_ioctl.c
@@ -23,6 +23,7 @@
23#include <linux/major.h> 23#include <linux/major.h>
24#include <linux/fs.h> 24#include <linux/fs.h>
25#include <linux/console.h> 25#include <linux/console.h>
26#include <linux/consolemap.h>
26#include <linux/signal.h> 27#include <linux/signal.h>
27#include <linux/timex.h> 28#include <linux/timex.h>
28 29
@@ -582,10 +583,27 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
582 case KDGKBDIACR: 583 case KDGKBDIACR:
583 { 584 {
584 struct kbdiacrs __user *a = up; 585 struct kbdiacrs __user *a = up;
586 struct kbdiacr diacr;
587 int i;
585 588
586 if (put_user(accent_table_size, &a->kb_cnt)) 589 if (put_user(accent_table_size, &a->kb_cnt))
587 return -EFAULT; 590 return -EFAULT;
588 if (copy_to_user(a->kbdiacr, accent_table, accent_table_size*sizeof(struct kbdiacr))) 591 for (i = 0; i < accent_table_size; i++) {
592 diacr.diacr = conv_uni_to_8bit(accent_table[i].diacr);
593 diacr.base = conv_uni_to_8bit(accent_table[i].base);
594 diacr.result = conv_uni_to_8bit(accent_table[i].result);
595 if (copy_to_user(a->kbdiacr + i, &diacr, sizeof(struct kbdiacr)))
596 return -EFAULT;
597 }
598 return 0;
599 }
600 case KDGKBDIACRUC:
601 {
602 struct kbdiacrsuc __user *a = up;
603
604 if (put_user(accent_table_size, &a->kb_cnt))
605 return -EFAULT;
606 if (copy_to_user(a->kbdiacruc, accent_table, accent_table_size*sizeof(struct kbdiacruc)))
589 return -EFAULT; 607 return -EFAULT;
590 return 0; 608 return 0;
591 } 609 }
@@ -593,6 +611,30 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
593 case KDSKBDIACR: 611 case KDSKBDIACR:
594 { 612 {
595 struct kbdiacrs __user *a = up; 613 struct kbdiacrs __user *a = up;
614 struct kbdiacr diacr;
615 unsigned int ct;
616 int i;
617
618 if (!perm)
619 return -EPERM;
620 if (get_user(ct,&a->kb_cnt))
621 return -EFAULT;
622 if (ct >= MAX_DIACR)
623 return -EINVAL;
624 accent_table_size = ct;
625 for (i = 0; i < ct; i++) {
626 if (copy_from_user(&diacr, a->kbdiacr + i, sizeof(struct kbdiacr)))
627 return -EFAULT;
628 accent_table[i].diacr = conv_8bit_to_uni(diacr.diacr);
629 accent_table[i].base = conv_8bit_to_uni(diacr.base);
630 accent_table[i].result = conv_8bit_to_uni(diacr.result);
631 }
632 return 0;
633 }
634
635 case KDSKBDIACRUC:
636 {
637 struct kbdiacrsuc __user *a = up;
596 unsigned int ct; 638 unsigned int ct;
597 639
598 if (!perm) 640 if (!perm)
@@ -602,7 +644,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
602 if (ct >= MAX_DIACR) 644 if (ct >= MAX_DIACR)
603 return -EINVAL; 645 return -EINVAL;
604 accent_table_size = ct; 646 accent_table_size = ct;
605 if (copy_from_user(accent_table, a->kbdiacr, ct*sizeof(struct kbdiacr))) 647 if (copy_from_user(accent_table, a->kbdiacruc, ct*sizeof(struct kbdiacruc)))
606 return -EFAULT; 648 return -EFAULT;
607 return 0; 649 return 0;
608 } 650 }