• Herbert Xu's avatar
    mac80211: Use linked list instead of rhashtable walk for mesh tables · b4c3fbe6
    Herbert Xu authored
    The mesh table code walks over hash tables for two purposes.  First of
    all it's used as part of a netlink dump process, but it is also used
    for looking up entries to delete using criteria other than the hash
    key.
    
    The second purpose is directly contrary to the design specification
    of rhashtable walks.  It is only meant for use by netlink dumps.
    
    This is because rhashtable is resizable and you cannot obtain a
    stable walk over it during a resize process.
    
    In fact mesh's use of rhashtable for dumping is bogus too.  Rather
    than using rhashtable walk's iterator to keep track of the current
    position, it always converts the current position to an integer
    which defeats the purpose of the iterator.
    
    Therefore this patch converts all uses of rhashtable walk into a
    simple linked list.
    
    This patch also adds a new spin lock to protect the hash table
    insertion/removal as well as the walk list modifications.  In fact
    the previous code was buggy as the removals can race with each
    other, potentially resulting in a double-free.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
    b4c3fbe6
mesh_pathtbl.c 21.4 KB