Fix a double-free bug which can occur if both bit error rate and packet

duplication probability are configured on a ng_pipe node.

Submitted by:	Jeffrey Ahrenholtz
MFC after:	3 days
This commit is contained in:
zec 2010-07-06 12:13:15 +00:00
parent ffe13fc705
commit da1f525af0

View File

@ -779,8 +779,9 @@ pipe_dequeue(struct hookinfo *hinfo, struct timeval *now) {
random() % 100 <= hinfo->cfg.duplicate) {
ngp_h = uma_zalloc(ngp_zone, M_NOWAIT);
KASSERT(ngp_h != NULL, ("ngp_h zalloc failed (3)"));
ngp_h->m = m_dup(m, M_NOWAIT);
KASSERT(ngp_h->m != NULL, ("m_dup failed"));
m = m_dup(m, M_NOWAIT);
KASSERT(m != NULL, ("m_dup failed"));
ngp_h->m = m;
} else {
TAILQ_REMOVE(&ngp_f->packet_head, ngp_h, ngp_link);
hinfo->run.qin_frames--;