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

vt: keyboard, union perm checks in vt_do_kdgkb_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-14-jslaby@suse.czSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 2374a045
......@@ -2040,9 +2040,6 @@ int vt_do_kdgkb_ioctl(int cmd, struct kbsentry __user *user_kdgkb, int perm)
char *kbs;
int ret;
if (!capable(CAP_SYS_TTY_CONFIG))
perm = 0;
if (get_user(kb_func, &user_kdgkb->kb_func))
return -EFAULT;
......@@ -2067,7 +2064,7 @@ int vt_do_kdgkb_ioctl(int cmd, struct kbsentry __user *user_kdgkb, int perm)
break;
}
case KDSKBSENT:
if (!perm)
if (!perm || !capable(CAP_SYS_TTY_CONFIG))
return -EPERM;
kbs = strndup_user(user_kdgkb->kb_string,
......
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