[Bug 206678] OGIO_KEYMAP command does not restore priority level
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Wed Jan 27 15:05:42 UTC 2016
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=206678
Bug ID: 206678
Summary: OGIO_KEYMAP command does not restore priority level
Product: Base System
Version: 11.0-CURRENT
Hardware: Any
OS: Any
Status: New
Severity: Affects Only Me
Priority: ---
Component: kern
Assignee: freebsd-bugs at FreeBSD.org
Reporter: ecturt at gmail.com
`genkbd_commonioctl` function from `sys/dev/kbd/kbd.c` begins by calling
`spltty()` to block hard interrupts from TTY:
int
genkbd_commonioctl(keyboard_t *kbd, u_long cmd, caddr_t arg)
{
keymap_t *mapp;
okeymap_t *omapp;
keyarg_t *keyp;
fkeyarg_t *fkeyp;splx
int s;
int i, j;
int error;
s = spltty();
switch (cmd) {
It should always restore the original priority level using the `splx` function
before returning. For example at the end of the function:
splx(s);
return (0);
}
And for any commands which need to return early:
case GIO_KEYMAP: /* get keyboard translation table */
error = copyout(kbd->kb_keymap, *(void **)arg,
sizeof(keymap_t));
splx(s);
return (error);
The problem is that for the `OGIO_KEYMAP` command, this does not happen:
case OGIO_KEYMAP: /* get keyboard translation table (compat) */
mapp = kbd->kb_keymap;
omapp = (okeymap_t *)arg;
omapp->n_keys = mapp->n_keys;
for (i = 0; i < NUM_KEYS; i++) {
for (j = 0; j < NUM_STATES; j++)
omapp->key[i].map[j] =
mapp->key[i].map[j];
omapp->key[i].spcl = mapp->key[i].spcl;
omapp->key[i].flgs = mapp->key[i].flgs;
}
return (0);
My guess is that since this is a compatibility command, it was copied into here
from somewhere else, which is why the call to `splx` is missing.
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-bugs
mailing list