diff options
author | Mark Johnston <markj@FreeBSD.org> | 2022-04-08 15:47:25 +0000 |
---|---|---|
committer | Mark Johnston <markj@FreeBSD.org> | 2022-04-15 14:21:20 +0000 |
commit | 421c2f93a4e03da9c6ed36913916b15c170949e6 (patch) | |
tree | 911b336259c16bd1df96d7f5b64e66cf884f481b /sys/netinet6/nd6.c | |
parent | 8b01c3026b78152d9e0ca6f3758ea226f32e48b9 (diff) |
net: Fix memory leaks in lltable_calc_llheader() error paths
Also convert raw epoch_call() calls to lltable_free_entry() calls, no
functional change intended. There's no need to asynchronously free the
LLEs in that case to begin with, but we might as well use the lltable
interfaces consistently.
Noticed by code inspection; I believe lltable_calc_llheader() failures
do not generally happen in practice.
Reviewed by: bz
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 990a6d18b0cb1eee9e18a4220150d549b9bee753)
Diffstat (limited to 'sys/netinet6/nd6.c')
-rw-r--r-- | sys/netinet6/nd6.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c index 6a9e2a4fdd7c..69da61aa9c5c 100644 --- a/sys/netinet6/nd6.c +++ b/sys/netinet6/nd6.c @@ -2036,8 +2036,10 @@ nd6_cache_lladdr(struct ifnet *ifp, struct in6_addr *from, char *lladdr, if (lladdr != NULL) { linkhdrsize = sizeof(linkhdr); if (lltable_calc_llheader(ifp, AF_INET6, lladdr, - linkhdr, &linkhdrsize, &lladdr_off) != 0) + linkhdr, &linkhdrsize, &lladdr_off) != 0) { + lltable_free_entry(LLTABLE6(ifp), ln); return; + } lltable_set_entry_addr(ifp, ln, linkhdr, linkhdrsize, lladdr_off); } |