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.
This commit is contained in:
parent
811ac7bb4f
commit
3ccd1982e5
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue