Lock interface address list when building a reply to NGM_EIFACE_GET_IFADDRS

messages in ng_eiface.

MFC after:	2 weeks
This commit is contained in:
Robert Watson 2009-04-19 22:04:29 +00:00
parent f25cc1d0d9
commit 315a0b84cc
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=191283

View File

@ -452,10 +452,12 @@ ng_eiface_rcvmsg(node_p node, item_p item, hook_p lasthook)
/* Determine size of response and allocate it */
buflen = 0;
IF_ADDR_LOCK(ifp);
TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link)
buflen += SA_SIZE(ifa->ifa_addr);
NG_MKRESPONSE(resp, msg, buflen, M_NOWAIT);
if (resp == NULL) {
IF_ADDR_UNLOCK(ifp);
error = ENOMEM;
break;
}
@ -474,6 +476,7 @@ ng_eiface_rcvmsg(node_p node, item_p item, hook_p lasthook)
ptr += len;
buflen -= len;
}
IF_ADDR_UNLOCK(ifp);
break;
}