• Florian Westphal's avatar
    xfrm: policy: increment xfrm_hash_generation on hash rebuild · 7a474c36
    Florian Westphal authored
    Hash rebuild will re-set all the inexact entries, then re-insert them.
    Lookups that can occur in parallel will therefore not find any policies.
    
    This was safe when lookups were still guarded by rwlock.
    After rcu-ification, lookups check the hash_generation seqcount to detect
    when a hash resize takes place.  Hash rebuild missed the needed increment.
    
    Hash resizes and hash rebuilds cannot occur in parallel (both acquire
    hash_resize_mutex), so just increment xfrm_hash_generation, like resize.
    
    Fixes: a7c44247 ("xfrm: policy: make xfrm_policy_lookup_bytype lockless")
    Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
    Signed-off-by: default avatarSteffen Klassert <steffen.klassert@secunet.com>
    7a474c36
xfrm_policy.c 101 KB