Commit 9d4f8e54 authored by Herbert Xu's avatar Herbert Xu
Browse files

rhashtable: Fix rhashtable_try_insert test



The test on whether rhashtable_insert_one did an insertion relies
on the value returned by rhashtable_lookup_one.  Unfortunately that
value is overwritten after rhashtable_insert_one returns.  Fix this
by moving the test before data gets overwritten.

Simplify the test as only data == NULL matters.

Finally move atomic_inc back within the lock as otherwise it may
be reordered with the atomic_dec on the removal side, potentially
leading to an underflow.

Reported-by: default avatarMichael Kelley <mhklinux@outlook.com>
Fixes: e1d3422c ("rhashtable: Fix potential deadlock by moving schedule_work outside lock")
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Tested-by: default avatarMichael Kelley <mhklinux@outlook.com>
Reviewed-by: default avatarBreno Leitao <leitao@debian.org>
Tested-by: default avatarMikhail Zaslonko <zaslonko@linux.ibm.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 076d9119
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment