Source-Changes-HG archive

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

[src/trunk]: src/sys/rump/net/lib/libshmif Take kernel lock before passing da...



details:   https://anonhg.NetBSD.org/src/rev/e2af5f033b9e
branches:  trunk
changeset: 757121:e2af5f033b9e
user:      pooka <pooka%NetBSD.org@localhost>
date:      Sun Aug 15 18:48:38 2010 +0000

description:
Take kernel lock before passing data to if_input.  This is in line
with IPL_NET interrupts generally not being MPSAFE.

diffstat:

 sys/rump/net/lib/libshmif/if_shmem.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (28 lines):

diff -r ecd13f84221b -r e2af5f033b9e sys/rump/net/lib/libshmif/if_shmem.c
--- a/sys/rump/net/lib/libshmif/if_shmem.c      Sun Aug 15 18:47:38 2010 +0000
+++ b/sys/rump/net/lib/libshmif/if_shmem.c      Sun Aug 15 18:48:38 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_shmem.c,v 1.21 2010/08/15 18:40:41 pooka Exp $      */
+/*     $NetBSD: if_shmem.c,v 1.22 2010/08/15 18:48:38 pooka Exp $      */
 
 /*
  * Copyright (c) 2009 Antti Kantee.  All Rights Reserved.
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_shmem.c,v 1.21 2010/08/15 18:40:41 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_shmem.c,v 1.22 2010/08/15 18:48:38 pooka Exp $");
 
 #include <sys/param.h>
 #include <sys/atomic.h>
@@ -310,7 +310,9 @@
                /* if it's from us, don't pass up and reuse storage space */
                eth = mtod(m, struct ether_header *);
                if (memcmp(eth->ether_shost, sc->sc_myaddr, 6) != 0) {
+                       KERNEL_LOCK(1, NULL);
                        ifp->if_input(ifp, m);
+                       KERNEL_UNLOCK_ONE(NULL);
                        m = NULL;
                }
        }



Home | Main Index | Thread Index | Old Index