Source-Changes-HG archive

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

[src/netbsd-8]: src/sys/dev Pull up following revision(s) (requested by mlels...



details:   https://anonhg.NetBSD.org/src/rev/4534f9518d57
branches:  netbsd-8
changeset: 446409:4534f9518d57
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Dec 04 12:00:41 2018 +0000

description:
Pull up following revision(s) (requested by mlelstv in ticket #1122):

        sys/dev/ld.c: revision 1.105

take kernel lock for ioctl calls when backend isn't tagged MPSAFE.

diffstat:

 sys/dev/ld.c |  12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diffs (42 lines):

diff -r c354961d0545 -r 4534f9518d57 sys/dev/ld.c
--- a/sys/dev/ld.c      Tue Dec 04 11:58:10 2018 +0000
+++ b/sys/dev/ld.c      Tue Dec 04 12:00:41 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ld.c,v 1.101.2.1 2017/09/01 09:59:10 martin Exp $      */
+/*     $NetBSD: ld.c,v 1.101.2.2 2018/12/04 12:00:41 martin Exp $      */
 
 /*-
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ld.c,v 1.101.2.1 2017/09/01 09:59:10 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ld.c,v 1.101.2.2 2018/12/04 12:00:41 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -369,7 +369,11 @@
                return (error);
 
        if (sc->sc_ioctl) {
+               if ((sc->sc_flags & LDF_MPSAFE) == 0)
+                       KERNEL_LOCK(1, curlwp);
                error = (*sc->sc_ioctl)(sc, cmd, addr, flag, 0);
+               if ((sc->sc_flags & LDF_MPSAFE) == 0)
+                       KERNEL_UNLOCK_ONE(curlwp);
                if (error != EPASSTHROUGH)
                        return (error);
        }
@@ -388,7 +392,11 @@
        struct ld_softc *sc = device_private(self);
 
        if (sc->sc_ioctl) {
+               if ((sc->sc_flags & LDF_MPSAFE) == 0)
+                       KERNEL_LOCK(1, curlwp);
                error = (*sc->sc_ioctl)(sc, DIOCCACHESYNC, NULL, 0, poll);
+               if ((sc->sc_flags & LDF_MPSAFE) == 0)
+                       KERNEL_UNLOCK_ONE(curlwp);
                if (error != 0)
                        device_printf(self, "unable to flush cache\n");
        }



Home | Main Index | Thread Index | Old Index