diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-18 17:39:57 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-18 17:39:57 +0000 |
commit | dc50eab76b709d68175a358d6e23a5a3890764d3 (patch) | |
tree | c754d0390db060af0213ff994f0ac310e4cfd6e9 /drivers/tty/vt | |
parent | Adding debian version 6.6.15-2. (diff) | |
download | linux-dc50eab76b709d68175a358d6e23a5a3890764d3.tar.xz linux-dc50eab76b709d68175a358d6e23a5a3890764d3.zip |
Merging upstream version 6.7.7.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'drivers/tty/vt')
-rw-r--r-- | drivers/tty/vt/consolemap.c | 2 | ||||
-rw-r--r-- | drivers/tty/vt/keyboard.c | 9 | ||||
-rw-r--r-- | drivers/tty/vt/vc_screen.c | 32 | ||||
-rw-r--r-- | drivers/tty/vt/vt.c | 29 |
4 files changed, 40 insertions, 32 deletions
diff --git a/drivers/tty/vt/consolemap.c b/drivers/tty/vt/consolemap.c index f02d21e2a9..5e39a4f430 100644 --- a/drivers/tty/vt/consolemap.c +++ b/drivers/tty/vt/consolemap.c @@ -205,7 +205,7 @@ static enum translation_map inv_translate[MAX_NR_CONSOLES]; FIELD_PREP(UNI_GLYPH_BITS, (glyph))) /** - * struct uni_pagedict -- unicode directory + * struct uni_pagedict - unicode directory * * @uni_pgdir: 32*32*64 table with glyphs * @refcount: reference count of this structure diff --git a/drivers/tty/vt/keyboard.c b/drivers/tty/vt/keyboard.c index 358f216c6c..12a192e119 100644 --- a/drivers/tty/vt/keyboard.c +++ b/drivers/tty/vt/keyboard.c @@ -1273,7 +1273,7 @@ static void kbd_bh(struct tasklet_struct *unused) } } -#if defined(CONFIG_X86) || defined(CONFIG_IA64) || defined(CONFIG_ALPHA) ||\ +#if defined(CONFIG_X86) || defined(CONFIG_ALPHA) ||\ defined(CONFIG_MIPS) || defined(CONFIG_PPC) || defined(CONFIG_SPARC) ||\ defined(CONFIG_PARISC) || defined(CONFIG_SUPERH) ||\ (defined(CONFIG_ARM) && defined(CONFIG_KEYBOARD_ATKBD) && !defined(CONFIG_ARCH_RPC)) @@ -2079,12 +2079,15 @@ int vt_do_kdgkb_ioctl(int cmd, struct kbsentry __user *user_kdgkb, int perm) return -ENOMEM; spin_lock_irqsave(&func_buf_lock, flags); - len = strlcpy(kbs, func_table[kb_func] ? : "", len); + len = strscpy(kbs, func_table[kb_func] ? : "", len); spin_unlock_irqrestore(&func_buf_lock, flags); + if (len < 0) { + ret = -ENOSPC; + break; + } ret = copy_to_user(user_kdgkb->kb_string, kbs, len + 1) ? -EFAULT : 0; - break; } case KDSKBSENT: diff --git a/drivers/tty/vt/vc_screen.c b/drivers/tty/vt/vc_screen.c index 829c4be66f..67e2cb7c96 100644 --- a/drivers/tty/vt/vc_screen.c +++ b/drivers/tty/vt/vc_screen.c @@ -174,7 +174,7 @@ vcs_poll_data_get(struct file *file) } /** - * vcs_vc -- return VC for @inode + * vcs_vc - return VC for @inode * @inode: inode for which to return a VC * @viewed: returns whether this console is currently foreground (viewed) * @@ -199,7 +199,7 @@ static struct vc_data *vcs_vc(struct inode *inode, bool *viewed) } /** - * vcs_size -- return size for a VC in @vc + * vcs_size - return size for a VC in @vc * @vc: which VC * @attr: does it use attributes? * @unicode: is it unicode? @@ -786,23 +786,22 @@ static const struct file_operations vcs_fops = { .release = vcs_release, }; -static struct class *vc_class; +static const struct class vc_class = { + .name = "vc", +}; void vcs_make_sysfs(int index) { - device_create(vc_class, NULL, MKDEV(VCS_MAJOR, index + 1), NULL, - "vcs%u", index + 1); - device_create(vc_class, NULL, MKDEV(VCS_MAJOR, index + 65), NULL, - "vcsu%u", index + 1); - device_create(vc_class, NULL, MKDEV(VCS_MAJOR, index + 129), NULL, - "vcsa%u", index + 1); + device_create(&vc_class, NULL, MKDEV(VCS_MAJOR, index + 1), NULL, "vcs%u", index + 1); + device_create(&vc_class, NULL, MKDEV(VCS_MAJOR, index + 65), NULL, "vcsu%u", index + 1); + device_create(&vc_class, NULL, MKDEV(VCS_MAJOR, index + 129), NULL, "vcsa%u", index + 1); } void vcs_remove_sysfs(int index) { - device_destroy(vc_class, MKDEV(VCS_MAJOR, index + 1)); - device_destroy(vc_class, MKDEV(VCS_MAJOR, index + 65)); - device_destroy(vc_class, MKDEV(VCS_MAJOR, index + 129)); + device_destroy(&vc_class, MKDEV(VCS_MAJOR, index + 1)); + device_destroy(&vc_class, MKDEV(VCS_MAJOR, index + 65)); + device_destroy(&vc_class, MKDEV(VCS_MAJOR, index + 129)); } int __init vcs_init(void) @@ -811,11 +810,12 @@ int __init vcs_init(void) if (register_chrdev(VCS_MAJOR, "vcs", &vcs_fops)) panic("unable to get major %d for vcs device", VCS_MAJOR); - vc_class = class_create("vc"); + if (class_register(&vc_class)) + panic("unable to create vc_class"); - device_create(vc_class, NULL, MKDEV(VCS_MAJOR, 0), NULL, "vcs"); - device_create(vc_class, NULL, MKDEV(VCS_MAJOR, 64), NULL, "vcsu"); - device_create(vc_class, NULL, MKDEV(VCS_MAJOR, 128), NULL, "vcsa"); + device_create(&vc_class, NULL, MKDEV(VCS_MAJOR, 0), NULL, "vcs"); + device_create(&vc_class, NULL, MKDEV(VCS_MAJOR, 64), NULL, "vcsu"); + device_create(&vc_class, NULL, MKDEV(VCS_MAJOR, 128), NULL, "vcsa"); for (i = 0; i < MIN_NR_CONSOLES; i++) vcs_make_sysfs(i); return 0; diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c index 5c47f77804..156efda7c8 100644 --- a/drivers/tty/vt/vt.c +++ b/drivers/tty/vt/vt.c @@ -2588,7 +2588,7 @@ static inline int vc_translate_ascii(const struct vc_data *vc, int c) /** - * vc_sanitize_unicode -- Replace invalid Unicode code points with U+FFFD + * vc_sanitize_unicode - Replace invalid Unicode code points with U+FFFD * @c: the received character, or U+FFFD for invalid sequences. */ static inline int vc_sanitize_unicode(const int c) @@ -2600,7 +2600,7 @@ static inline int vc_sanitize_unicode(const int c) } /** - * vc_translate_unicode -- Combine UTF-8 into Unicode in @vc_utf_char + * vc_translate_unicode - Combine UTF-8 into Unicode in @vc_utf_char * @vc: virtual console * @c: character to translate * @rescan: we return true if we need more (continuation) data @@ -3155,9 +3155,13 @@ int tioclinux(struct tty_struct *tty, unsigned long arg) switch (type) { case TIOCL_SETSEL: + if (!capable(CAP_SYS_ADMIN)) + return -EPERM; return set_selection_user((struct tiocl_selection __user *)(p+1), tty); case TIOCL_PASTESEL: + if (!capable(CAP_SYS_ADMIN)) + return -EPERM; return paste_selection(tty); case TIOCL_UNBLANKSCREEN: console_lock(); @@ -3165,6 +3169,8 @@ int tioclinux(struct tty_struct *tty, unsigned long arg) console_unlock(); break; case TIOCL_SELLOADLUT: + if (!capable(CAP_SYS_ADMIN)) + return -EPERM; console_lock(); ret = sel_loadlut(p); console_unlock(); @@ -3565,7 +3571,9 @@ int __init vty_init(const struct file_operations *console_fops) return 0; } -static struct class *vtconsole_class; +static const struct class vtconsole_class = { + .name = "vtconsole", +}; static int do_bind_con_driver(const struct consw *csw, int first, int last, int deflt) @@ -4092,7 +4100,7 @@ static int do_register_con_driver(const struct consw *csw, int first, int last) goto err; con_driver->dev = - device_create_with_groups(vtconsole_class, NULL, + device_create_with_groups(&vtconsole_class, NULL, MKDEV(0, con_driver->node), con_driver, con_dev_groups, "vtcon%i", con_driver->node); @@ -4173,7 +4181,7 @@ static void con_driver_unregister_callback(struct work_struct *ignored) console_unlock(); vtconsole_deinit_device(con_driver); - device_destroy(vtconsole_class, MKDEV(0, con_driver->node)); + device_destroy(&vtconsole_class, MKDEV(0, con_driver->node)); console_lock(); @@ -4234,12 +4242,9 @@ static int __init vtconsole_class_init(void) { int i; - vtconsole_class = class_create("vtconsole"); - if (IS_ERR(vtconsole_class)) { - pr_warn("Unable to create vt console class; errno = %ld\n", - PTR_ERR(vtconsole_class)); - vtconsole_class = NULL; - } + i = class_register(&vtconsole_class); + if (i) + pr_warn("Unable to create vt console class; errno = %d\n", i); /* Add system drivers to sysfs */ for (i = 0; i < MAX_NR_CON_DRIVER; i++) { @@ -4247,7 +4252,7 @@ static int __init vtconsole_class_init(void) if (con->con && !con->dev) { con->dev = - device_create_with_groups(vtconsole_class, NULL, + device_create_with_groups(&vtconsole_class, NULL, MKDEV(0, con->node), con, con_dev_groups, "vtcon%i", con->node); |