From owner-svn-src-head@freebsd.org Wed Nov 1 22:15:20 2017 Return-Path: Delivered-To: svn-src-head@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 C1D91E65ACA; Wed, 1 Nov 2017 22:15:20 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 8F5579D9; Wed, 1 Nov 2017 22:15:20 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vA1MFJ93048741; Wed, 1 Nov 2017 22:15:19 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vA1MFJhp048740; Wed, 1 Nov 2017 22:15:19 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201711012215.vA1MFJhp048740@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Wed, 1 Nov 2017 22:15:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325295 - head/sys/dev/evdev X-SVN-Group: head X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: head/sys/dev/evdev X-SVN-Commit-Revision: 325295 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Nov 2017 22:15:20 -0000 Author: wulf Date: Wed Nov 1 22:15:19 2017 New Revision: 325295 URL: https://svnweb.freebsd.org/changeset/base/325295 Log: evdev: Lock Giant around keyboard ioctls This fixes turning ukbd(4) LEDs on/off with evdev interface as well Reviewed by: gonzo Approved by: gonzo (mentor) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D12676 Modified: head/sys/dev/evdev/evdev_utils.c Modified: head/sys/dev/evdev/evdev_utils.c ============================================================================== --- head/sys/dev/evdev/evdev_utils.c Wed Nov 1 22:09:10 2017 (r325294) +++ head/sys/dev/evdev/evdev_utils.c Wed Nov 1 22:15:19 2017 (r325295) @@ -32,7 +32,9 @@ #include #include #include +#include #include +#include #include #include @@ -314,19 +316,26 @@ evdev_ev_kbd_event(struct evdev_dev *evdev, void *soft leds |= 1 << i; else leds &= ~(1 << i); - if (leds != oleds) + if (leds != oleds) { + mtx_lock(&Giant); kbdd_ioctl(kbd, KDSETLED, (caddr_t)&leds); + mtx_unlock(&Giant); + } break; } } } else if (type == EV_REP && code == REP_DELAY) { delay[0] = value; delay[1] = kbd->kb_delay2; + mtx_lock(&Giant); kbdd_ioctl(kbd, KDSETREPEAT, (caddr_t)delay); + mtx_unlock(&Giant); } else if (type == EV_REP && code == REP_PERIOD) { delay[0] = kbd->kb_delay1; delay[1] = value; + mtx_lock(&Giant); kbdd_ioctl(kbd, KDSETREPEAT, (caddr_t)delay); + mtx_unlock(&Giant); } }