Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pad pad(4): Take kernel lock around autoconf stuff.



details:   https://anonhg.NetBSD.org/src/rev/202d5dfcb655
branches:  trunk
changeset: 379677:202d5dfcb655
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Jun 13 23:09:22 2021 +0000

description:
pad(4): Take kernel lock around autoconf stuff.

This is not really enough -- the padconfig locking logic violates
rules about sleeping while holding locks, might be deadlocky, and may
also be racy.  But, it'll serve to make progress.

diffstat:

 sys/dev/pad/pad.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (28 lines):

diff -r 3bda998c6936 -r 202d5dfcb655 sys/dev/pad/pad.c
--- a/sys/dev/pad/pad.c Sun Jun 13 21:54:51 2021 +0000
+++ b/sys/dev/pad/pad.c Sun Jun 13 23:09:22 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pad.c,v 1.66 2021/06/08 09:09:28 nia Exp $ */
+/* $NetBSD: pad.c,v 1.67 2021/06/13 23:09:22 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pad.c,v 1.66 2021/06/08 09:09:28 nia Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pad.c,v 1.67 2021/06/13 23:09:22 riastradh Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -362,7 +362,9 @@ cdev_pad_open(dev_t dev, int flags, int 
        sc->sc_swvol = 255;
        sc->sc_buflen = 0;
        sc->sc_rpos = sc->sc_wpos = 0;
+       KERNEL_LOCK(1, NULL);
        sc->sc_audiodev = audio_attach_mi(&pad_hw_if, sc, sc->sc_dev);
+       KERNEL_UNLOCK_ONE(NULL);
 
        if (!pmf_device_register(sc->sc_dev, NULL, NULL))
                aprint_error_dev(sc->sc_dev,



Home | Main Index | Thread Index | Old Index