Source-Changes-HG archive

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

[src/trunk]: src/sys/dist/ipf/netinet kern/30082 - fr_check() is missing SPL_...



details:   https://anonhg.NetBSD.org/src/rev/a84d3c735aab
branches:  trunk
changeset: 581944:a84d3c735aab
user:      darrenr <darrenr%NetBSD.org@localhost>
date:      Sat Jun 11 11:25:28 2005 +0000

description:
kern/30082 - fr_check() is missing SPL_NET() macros for non-mutex using
platforms, allowing it to be preempted and restarted in an inconsistent
state.

diffstat:

 sys/dist/ipf/netinet/fil.c       |  9 +++++++--
 sys/dist/ipf/netinet/ip_compat.h |  8 +++++++-
 2 files changed, 14 insertions(+), 3 deletions(-)

diffs (67 lines):

diff -r a5bade403f12 -r a84d3c735aab sys/dist/ipf/netinet/fil.c
--- a/sys/dist/ipf/netinet/fil.c        Sat Jun 11 08:54:35 2005 +0000
+++ b/sys/dist/ipf/netinet/fil.c        Sat Jun 11 11:25:28 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fil.c,v 1.14 2005/05/29 21:57:49 christos Exp $        */
+/*     $NetBSD: fil.c,v 1.15 2005/06/11 11:25:28 darrenr Exp $ */
 
 /*
  * Copyright (C) 1993-2003 by Darren Reed.
@@ -135,7 +135,7 @@
 #if !defined(lint)
 #if defined(__NetBSD__)
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fil.c,v 1.14 2005/05/29 21:57:49 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fil.c,v 1.15 2005/06/11 11:25:28 darrenr Exp $");
 #else
 static const char sccsid[] = "@(#)fil.c        1.36 6/5/96 (C) 1993-2000 Darren Reed";
 static const char rcsid[] = "@(#)Id: fil.c,v 2.243.2.57 2005/03/28 10:47:50 darrenr Exp";
@@ -2200,6 +2200,7 @@
 #ifdef USE_INET6
        ip6_t *ip6;
 #endif
+       SPL_INT(s);
 
        /*
         * The first part of fr_check() deals with making sure that what goes
@@ -2280,6 +2281,8 @@
 
        fin->fin_ipoff = (char *)ip - MTOD(m, char *);
 
+       SPL_NET(s);
+
 #ifdef USE_INET6
        if (v == 6) {
                ATOMIC_INCL(frstats[out].fr_ipv6);
@@ -2508,7 +2511,9 @@
 #endif
        }
 
+       SPL_X(s);
        RWLOCK_EXIT(&ipf_global);
+
 #ifdef _KERNEL
 # if OpenBSD >= 200311    
        if (FR_ISPASS(pass) && (v == 4)) {
diff -r a5bade403f12 -r a84d3c735aab sys/dist/ipf/netinet/ip_compat.h
--- a/sys/dist/ipf/netinet/ip_compat.h  Sat Jun 11 08:54:35 2005 +0000
+++ b/sys/dist/ipf/netinet/ip_compat.h  Sat Jun 11 11:25:28 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip_compat.h,v 1.5 2005/04/03 15:05:30 martti Exp $     */
+/*     $NetBSD: ip_compat.h,v 1.6 2005/06/11 11:25:28 darrenr Exp $    */
 
 /*
  * Copyright (C) 1993-2001, 2003 by Darren Reed.
@@ -1377,6 +1377,12 @@
 
 #endif
 
+#if defined(USE_SPL) && defined(_KERNEL)
+# define       SPL_INT(x)      int x
+#else
+# define       SPL_INT(x)
+#endif
+
 #define        MAX_IPV4HDR     ((0xf << 2) + sizeof(struct icmp) + sizeof(ip_t) + 8)
 
 #ifndef        IP_OFFMASK



Home | Main Index | Thread Index | Old Index