diff options
author | rwatson <rwatson@FreeBSD.org> | 2009-04-19 22:04:29 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2009-04-19 22:04:29 +0000 |
commit | 8a092572b5bd1329fb27209e9129841ed65ed859 (patch) | |
tree | 2da099366411108238c032d23459b79f5a2ea664 | |
parent | 1e1a0b82b34f1ae64d21ef6fa351b5057da220dc (diff) | |
download | FreeBSD-src-8a092572b5bd1329fb27209e9129841ed65ed859.zip FreeBSD-src-8a092572b5bd1329fb27209e9129841ed65ed859.tar.gz |
Lock interface address list when building a reply to NGM_EIFACE_GET_IFADDRS
messages in ng_eiface.
MFC after: 2 weeks
-rw-r--r-- | sys/netgraph/ng_eiface.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/sys/netgraph/ng_eiface.c b/sys/netgraph/ng_eiface.c index 542eaad..eb638fe 100644 --- a/sys/netgraph/ng_eiface.c +++ b/sys/netgraph/ng_eiface.c @@ -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; } |