Commit ee1cf8a5 authored by Jiri Slaby's avatar Jiri Slaby Committed by Greg Kroah-Hartman

vt: keyboard, union perm checks in vt_do_kdsk_ioctl

Do the permission check on a single place. That is where perm is really
checked.
Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
Link: https://lore.kernel.org/r/20201029113222.32640-7-jslaby@suse.czSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent fe6416e1
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment