From owner-freebsd-bugs@freebsd.org Wed Jan 27 15:05:42 2016 Return-Path: Delivered-To: freebsd-bugs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 957EDA700DC for ; Wed, 27 Jan 2016 15:05:42 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6CC201AD0 for ; Wed, 27 Jan 2016 15:05:42 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id u0RF5gWR062892 for ; Wed, 27 Jan 2016 15:05:42 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: freebsd-bugs@FreeBSD.org Subject: [Bug 206678] OGIO_KEYMAP command does not restore priority level Date: Wed, 27 Jan 2016 15:05:42 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: 11.0-CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: ecturt@gmail.com X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: freebsd-bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Jan 2016 15:05:42 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D206678 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@FreeBSD.org Reporter: ecturt@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 =3D spltty(); switch (cmd) { It should always restore the original priority level using the `splx` funct= ion 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 =3D 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 =3D kbd->kb_keymap; omapp =3D (okeymap_t *)arg; omapp->n_keys =3D mapp->n_keys; for (i =3D 0; i < NUM_KEYS; i++) { for (j =3D 0; j < NUM_STATES; j++) omapp->key[i].map[j] =3D mapp->key[i].map[j]; omapp->key[i].spcl =3D mapp->key[i].spcl; omapp->key[i].flgs =3D 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. --=20 You are receiving this mail because: You are the assignee for the bug.=