Commit 9d4f8e5
committed
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: Michael Kelley <[email protected]>
Fixes: e1d3422 ("rhashtable: Fix potential deadlock by moving schedule_work outside lock")
Signed-off-by: Herbert Xu <[email protected]>
Tested-by: Michael Kelley <[email protected]>
Reviewed-by: Breno Leitao <[email protected]>
Tested-by: Mikhail Zaslonko <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>1 parent 076d911 commit 9d4f8e5
1 file changed
+7
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
611 | 611 | | |
612 | 612 | | |
613 | 613 | | |
| 614 | + | |
| 615 | + | |
614 | 616 | | |
615 | 617 | | |
616 | 618 | | |
617 | 619 | | |
618 | 620 | | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
619 | 624 | | |
620 | 625 | | |
621 | 626 | | |
622 | 627 | | |
623 | 628 | | |
624 | | - | |
625 | | - | |
626 | | - | |
627 | | - | |
628 | | - | |
| 629 | + | |
| 630 | + | |
629 | 631 | | |
630 | 632 | | |
631 | 633 | | |
| |||
0 commit comments