summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2025-01-14 11:15:19 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-02-08 09:57:35 +0100
commitf939008a52c5232d531f23354502da9dfe99857e (patch)
treee73d22870e5ab17a3ec7326e74a16ece2663e9fd /kernel
parent8ca38d0ca8c3d30dd18d311f1a7ec5cb56972cac (diff)
downloadlinux-f939008a52c5232d531f23354502da9dfe99857e.tar.gz
linux-f939008a52c5232d531f23354502da9dfe99857e.tar.bz2
linux-f939008a52c5232d531f23354502da9dfe99857e.zip
rhashtable: Fix rhashtable_try_insert test
[ Upstream commit 9d4f8e54cef2c42e23ef258833dbd06a1eaff89b ] 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 <mhklinux@outlook.com> Fixes: e1d3422c95f0 ("rhashtable: Fix potential deadlock by moving schedule_work outside lock") Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Tested-by: Michael Kelley <mhklinux@outlook.com> Reviewed-by: Breno Leitao <leitao@debian.org> Tested-by: Mikhail Zaslonko <zaslonko@linux.ibm.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'kernel')
0 files changed, 0 insertions, 0 deletions