summaryrefslogtreecommitdiffstats
path: root/freebsd/sys/dev/evdev/cdev.c
diff options
context:
space:
mode:
Diffstat (limited to 'freebsd/sys/dev/evdev/cdev.c')
-rw-r--r--freebsd/sys/dev/evdev/cdev.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/freebsd/sys/dev/evdev/cdev.c b/freebsd/sys/dev/evdev/cdev.c
index 5ae14fed..a9370e7e 100644
--- a/freebsd/sys/dev/evdev/cdev.c
+++ b/freebsd/sys/dev/evdev/cdev.c
@@ -351,6 +351,19 @@ evdev_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag,
if (client->ec_revoked || evdev == NULL)
return (ENODEV);
+ /*
+ * Fix evdev state corrupted with discarding of kdb events.
+ * EVIOCGKEY and EVIOCGLED ioctls can suffer from this.
+ */
+ if (evdev->ev_kdb_active) {
+ EVDEV_LOCK(evdev);
+ if (evdev->ev_kdb_active) {
+ evdev->ev_kdb_active = false;
+ evdev_restore_after_kdb(evdev);
+ }
+ EVDEV_UNLOCK(evdev);
+ }
+
/* file I/O ioctl handling */
switch (cmd) {
case FIOSETOWN: