net: Fix LLE lock leaks
Historically, lltable_try_set_entry_addr() would release the LLE lock
upon failure. After some refactoring, it no longer does so, but
consumers were not adjusted accordingly.
Also fix a leak that can occur if lltable_calc_llheader() fails in the
ARP code, but I suspect that such a failure can only occur due to a code
bug.
Reviewed by: bz, melifaro
Reported by: pho
Fixes: 0b79b007eb
("[lltable] Restructure nd6 code.")
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34831
This commit is contained in:
parent
fcaf016796
commit
dd91d84486
@ -1228,16 +1228,20 @@ arp_check_update_lle(struct arphdr *ah, struct in_addr isaddr, struct ifnet *ifp
|
||||
/* Calculate full link prepend to use in lle */
|
||||
linkhdrsize = sizeof(linkhdr);
|
||||
if (lltable_calc_llheader(ifp, AF_INET, ar_sha(ah), linkhdr,
|
||||
&linkhdrsize, &lladdr_off) != 0)
|
||||
&linkhdrsize, &lladdr_off) != 0) {
|
||||
LLE_WUNLOCK(la);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Check if something has changed */
|
||||
if (memcmp(la->r_linkdata, linkhdr, linkhdrsize) != 0 ||
|
||||
(la->la_flags & LLE_VALID) == 0) {
|
||||
/* Try to perform LLE update */
|
||||
if (lltable_try_set_entry_addr(ifp, la, linkhdr, linkhdrsize,
|
||||
lladdr_off) == 0)
|
||||
lladdr_off) == 0) {
|
||||
LLE_WUNLOCK(la);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Clear fast path feedback request if set */
|
||||
llentry_mark_used(la);
|
||||
|
@ -855,10 +855,8 @@ nd6_na_input(struct mbuf *m, int off, int icmp6len)
|
||||
linkhdr, &linkhdrsize, &lladdr_off) != 0)
|
||||
goto freeit;
|
||||
if (lltable_try_set_entry_addr(ifp, ln, linkhdr,
|
||||
linkhdrsize, lladdr_off) == 0) {
|
||||
ln = NULL;
|
||||
linkhdrsize, lladdr_off) == 0)
|
||||
goto freeit;
|
||||
}
|
||||
EVENTHANDLER_INVOKE(lle_event, ln,
|
||||
LLENTRY_RESOLVED);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user