Module Name: src
Committed By: jakllsch
Date: Fri Dec 16 00:58:00 UTC 2011
Modified Files:
src/sys/netinet6: frag6.c
Log Message:
Take softnet_lock and kernel lock in frag6_slowtimo and frag6_fasttimo,
similar to how it's done with other protocols.
If we don't do this sending ICMPv6 messages in this path can cause races
in network interface drivers.
To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/netinet6/frag6.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/netinet6/frag6.c
diff -u src/sys/netinet6/frag6.c:1.50 src/sys/netinet6/frag6.c:1.51
--- src/sys/netinet6/frag6.c:1.50 Fri Nov 4 00:22:33 2011
+++ src/sys/netinet6/frag6.c Fri Dec 16 00:57:59 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: frag6.c,v 1.50 2011/11/04 00:22:33 zoltan Exp $ */
+/* $NetBSD: frag6.c,v 1.51 2011/12/16 00:57:59 jakllsch Exp $ */
/* $KAME: frag6.c,v 1.40 2002/05/27 21:40:31 itojun Exp $ */
/*
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: frag6.c,v 1.50 2011/11/04 00:22:33 zoltan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: frag6.c,v 1.51 2011/12/16 00:57:59 jakllsch Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -644,10 +644,16 @@ frag6_remque(struct ip6q *p6)
void
frag6_fasttimo(void)
{
+ mutex_enter(softnet_lock);
+ KERNEL_LOCK(1, NULL);
+
if (frag6_drainwanted) {
frag6_drain();
frag6_drainwanted = 0;
}
+
+ KERNEL_UNLOCK_ONE(NULL);
+ mutex_exit(softnet_lock);
}
/*
@@ -660,6 +666,9 @@ frag6_slowtimo(void)
{
struct ip6q *q6;
+ mutex_enter(softnet_lock);
+ KERNEL_LOCK(1, NULL);
+
mutex_enter(&frag6_lock);
q6 = ip6q.ip6q_next;
if (q6)
@@ -685,6 +694,9 @@ frag6_slowtimo(void)
}
mutex_exit(&frag6_lock);
+ KERNEL_UNLOCK_ONE(NULL);
+ mutex_exit(softnet_lock);
+
#if 0
/*
* Routing changes might produce a better route than we last used;