summaryrefslogtreecommitdiff
path: root/drivers/virt
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2024-09-09 12:50:09 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-10-17 15:21:29 +0200
commit842d9156be5633e34c6a8811e81d36566b091280 (patch)
tree94d2512bae9f7b25c1059e3c95b3fa072082c2f4 /drivers/virt
parent0f05d6c3376bace13c1fd962fceadc5bbd233299 (diff)
downloadlinux-842d9156be5633e34c6a8811e81d36566b091280.tar.gz
linux-842d9156be5633e34c6a8811e81d36566b091280.tar.bz2
linux-842d9156be5633e34c6a8811e81d36566b091280.zip
jump_label: Fix static_key_slow_dec() yet again
[ Upstream commit 1d7f856c2ca449f04a22d876e36b464b7a9d28b6 ] While commit 83ab38ef0a0b ("jump_label: Fix concurrency issues in static_key_slow_dec()") fixed one problem, it created yet another, notably the following is now possible: slow_dec if (try_dec) // dec_not_one-ish, false // enabled == 1 slow_inc if (inc_not_disabled) // inc_not_zero-ish // enabled == 2 return guard((mutex)(&jump_label_mutex); if (atomic_cmpxchg(1,0)==1) // false, we're 2 slow_dec if (try-dec) // dec_not_one, true // enabled == 1 return else try_dec() // dec_not_one, false WARN Use dec_and_test instead of cmpxchg(), like it was prior to 83ab38ef0a0b. Add a few WARNs for the paranoid. Fixes: 83ab38ef0a0b ("jump_label: Fix concurrency issues in static_key_slow_dec()") Reported-by: "Darrick J. Wong" <djwong@kernel.org> Tested-by: Klara Modin <klarasmodin@gmail.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/virt')
0 files changed, 0 insertions, 0 deletions