Page MenuHomeFreeBSD

Fix lock order reversal when calling defrouter_remove() from nd6_na_input(). nd6_na_input() can take lle lock before nd6 lock in certain cases.
Needs ReviewPublic

Authored by darrick.freebsd_gmail.com on Oct 3 2018, 8:19 PM.

Details

Reviewers
ae
melifaro
cem
markj
Group Reviewers
network
Summary

Fix lock order reversal in nd6_na_input().

Test Plan

Verified using rawsocket test that LOR no longer occurs.

Diff Detail

Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 20076
Build 19575: arc lint + arc unit

Event Timeline

ae set the repository for this revision to rS FreeBSD src repository.
markj added inline comments.Oct 8 2018, 5:14 PM
sys/netinet6/nd6_nbr.c
639

These can be of type bool.

removed_defrouter is redundant, you can just initialize dr = NULL and test it.

747

It is rather unfortunate that we have to take a global (well, vnet-global) lock for every NA. :(

885

It can be a bit simpler:

dr = defrouter_lookup_locked(...);
if (dr != NULL) {
    ...
} else if ((ND_IFINFO(nd6_ifp)->flags & ND6_IFF_ACCEPT_RTADV) != 0) {
    ....
}
910

This can be:

if (nd6_locked) {
    ND6_WUNLOCK();
    if (dr != NULL) {
        ...
    }
}
  • Incorporate CR feedback.
This comment was removed by darrick.freebsd_gmail.com.