Hold kernel_lock across IFNET_FOREACH().

This commit is contained in:
ad 2008-01-07 16:13:49 +00:00
parent 77e0b2120f
commit 8b52263cd1

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_uuid.c,v 1.12 2007/12/20 23:03:09 dsl Exp $ */
/* $NetBSD: kern_uuid.c,v 1.13 2008/01/07 16:13:49 ad Exp $ */
/*
* Copyright (c) 2002 Marcel Moolenaar
@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kern_uuid.c,v 1.12 2007/12/20 23:03:09 dsl Exp $");
__KERNEL_RCSID(0, "$NetBSD: kern_uuid.c,v 1.13 2008/01/07 16:13:49 ad Exp $");
#include <sys/param.h>
#include <sys/endian.h>
@ -110,6 +110,7 @@ uuid_node(uint16_t *node)
int i, s;
s = splnet();
KERNEL_LOCK(1, NULL);
IFNET_FOREACH(ifp) {
/* Walk the address list */
IFADDR_FOREACH(ifa, ifp) {
@ -118,11 +119,13 @@ uuid_node(uint16_t *node)
sdl->sdl_type == IFT_ETHER) {
/* Got a MAC address. */
memcpy(node, CLLADDR(sdl), UUID_NODE_LEN);
KERNEL_UNLOCK_ONE(NULL);
splx(s);
return;
}
}
}
KERNEL_UNLOCK_ONE(NULL);
splx(s);
for (i = 0; i < (UUID_NODE_LEN>>1); i++)