f6b311b mmap_cache: Skip records which doesn't have same hash

1 file Authored by lslebodn 10 years ago, Committed by jhrozek 10 years ago,
    mmap_cache: Skip records which doesn't have same hash
    
    The code uses 2 hashes for each record, but only one hash table to
    index them both, furthermore each record has only one single 'next'
    pointer.
    
    This means that in certain conditions a record main end up being on a
    hash chain even though its hashes do not match the hash chain. This can
    happen when another record 'drags' it in from another hash chain where
    they both belong.
    
    If the record without matching hashes happens to be the second of the
    chain and the first record is removed, then the non matching record is
    left on the wrong chain. On removal of the non-matching record the hash
    chain will not be updated and the hash chain will end up pointing to an
    invalid slot.
    This slot may be later reused for another record and may not be the
    first slot of this new record. In this case the hash chain will point to
    arbitrary data and may cause issues if the slot is interpreted as the
    head of a record.
    
    By skipping any block that has no matching hashes upon removing the
    first record in a chain we insure that dangling references cannot be
    left in the hash table
    
    Resolves:
    https://fedorahosted.org/sssd/ticket/2049