nd_resolve: Maintain la_numheld.
Otherwise lltable_drop_entry_queue never drops anything. Addresses mbuf leak, PR kern/58297.
This commit is contained in:
parent
e78cefbe42
commit
c5ebb1a017
17
sys/net/nd.c
17
sys/net/nd.c
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: nd.c,v 1.5 2022/11/19 08:00:51 yamt Exp $ */
|
||||
/* $NetBSD: nd.c,v 1.6 2024/05/28 22:15:22 riastradh Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2020 The NetBSD Foundation, Inc.
|
||||
|
@ -28,7 +28,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: nd.c,v 1.5 2022/11/19 08:00:51 yamt Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: nd.c,v 1.6 2024/05/28 22:15:22 riastradh Exp $");
|
||||
|
||||
#include <sys/callout.h>
|
||||
#include <sys/mbuf.h>
|
||||
|
@ -374,14 +374,25 @@ nd_resolve(struct llentry *ln, const struct rtentry *rt, struct mbuf *m,
|
|||
break;
|
||||
}
|
||||
}
|
||||
KASSERTMSG(ln->la_numheld == i, "la_numheld=%d i=%d",
|
||||
ln->la_numheld, i);
|
||||
while (i >= nd->nd_maxqueuelen) {
|
||||
m_hold = ln->ln_hold;
|
||||
ln->ln_hold = ln->ln_hold->m_nextpkt;
|
||||
m_freem(m_hold);
|
||||
i--;
|
||||
ln->la_numheld--;
|
||||
}
|
||||
} else
|
||||
} else {
|
||||
KASSERTMSG(ln->la_numheld == 0, "la_numheld=%d",
|
||||
ln->la_numheld);
|
||||
ln->ln_hold = m;
|
||||
}
|
||||
|
||||
KASSERTMSG(ln->la_numheld < nd->nd_maxqueuelen,
|
||||
"la_numheld=%d nd_maxqueuelen=%d",
|
||||
ln->la_numheld, nd->nd_maxqueuelen);
|
||||
ln->la_numheld++;
|
||||
|
||||
if (ln->ln_asked >= nd->nd_mmaxtries)
|
||||
error = (rt != NULL && rt->rt_flags & RTF_GATEWAY) ?
|
||||
|
|
Loading…
Reference in New Issue