lkml.org 
[lkml]   [2020]   [Oct]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 14/17] vt: keyboard, union perm checks in vt_do_kdgkb_ioctl
Date
Do the permission check on a single place. That is where perm is
really checked.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
drivers/tty/vt/keyboard.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/tty/vt/keyboard.c b/drivers/tty/vt/keyboard.c
index 648bdfb05e25..1de0d5217aed 100644
--- a/drivers/tty/vt/keyboard.c
+++ b/drivers/tty/vt/keyboard.c
@@ -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,
--
2.29.1
\
 
 \ /
  Last update: 2020-10-29 12:33    [W:0.495 / U:0.344 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site