• Eric Dumazet's avatar
    fib: fix fib_nl_newrule() · ebb9fed2
    Eric Dumazet authored
    Some panic reports in fib_rules_lookup() show a rule could have a NULL
    pointer as a next pointer in the rules_list.
    
    This can actually happen because of a bug in fib_nl_newrule() : It
    checks if current rule is the destination of unresolved gotos. (Other
    rules have gotos to this about to be inserted rule)
    
    Problem is it does the resolution of the gotos before the rule is
    inserted in the rules_list (and has a valid next pointer)
    
    Fix this by moving the rules_list insertion before the changes on gotos.
    
    A lockless reader can not any more follow a ctarget pointer, unless
    destination is ready (has a valid next pointer)
    Reported-by: default avatarOleg A. Arkhangelsky <sysoleg@yandex.ru>
    Reported-by: default avatarJoe Buehler <aspam@cox.net>
    Signed-off-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    ebb9fed2
fib_rules.c 16.5 KB