• Thomas Graf's avatar
    rhashtable: Avoid bucket cross reference after removal · cf52d52f
    Thomas Graf authored
    During a resize, when two buckets in the larger table map to
    a single bucket in the smaller table and the new table has already
    been (partially) linked to the old table. Removal of an element
    may result the bucket in the larger table to point to entries
    which all hash to a different value than the bucket index. Thus
    causing two buckets to point to the same sub chain after unzipping.
    This is not illegal *during* the resize phase but after it has
    completed.
    
    Keep the old table around until all of the unzipping is done to
    allow the removal code to only search for matching hashed entries
    during this special period.
    Reported-by: default avatarYing Xue <ying.xue@windriver.com>
    Fixes: 97defe1e ("rhashtable: Per bucket locks & deferred expansion/shrinking")
    Signed-off-by: default avatarThomas Graf <tgraf@suug.ch>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    cf52d52f
rhashtable.c 30.1 KB