projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
fe6416e
)
vt: keyboard, union perm checks in vt_do_kdsk_ioctl
author
Jiri Slaby
<jslaby@suse.cz>
Thu, 29 Oct 2020 11:32:12 +0000
(12:32 +0100)
committer
Greg Kroah-Hartman
<gregkh@linuxfoundation.org>
Wed, 4 Nov 2020 15:43:38 +0000
(16:43 +0100)
Do the permission check on a single place. That is where perm is really
checked.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Link:
https://lore.kernel.org/r/20201029113222.32640-7-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/vt/keyboard.c
patch
|
blob
|
history
diff --git
a/drivers/tty/vt/keyboard.c
b/drivers/tty/vt/keyboard.c
index c1709b8dbb523f0a87302276969cf82e4448cfb9..823df9bb52b1ded7c1a3d458a15e11314f338018 100644
(file)
--- a/
drivers/tty/vt/keyboard.c
+++ b/
drivers/tty/vt/keyboard.c
@@
-2004,16
+2004,13
@@
int vt_do_kdsk_ioctl(int cmd, struct kbentry __user *user_kbe, int perm,
if (copy_from_user(&kbe, user_kbe, sizeof(struct kbentry)))
return -EFAULT;
- if (!capable(CAP_SYS_TTY_CONFIG))
- perm = 0;
-
switch (cmd) {
case KDGKBENT:
return put_user(vt_kdgkbent(kb->kbdmode, kbe.kb_index,
kbe.kb_table),
&user_kbe->kb_value);
case KDSKBENT:
- if (!perm)
+ if (!perm
|| !capable(CAP_SYS_TTY_CONFIG)
)
return -EPERM;
return vt_kdskbent(kb->kbdmode, kbe.kb_index, kbe.kb_table,
kbe.kb_value);