Patch "jump_label: Fix the fix, brown paper bags galore" has been added to the 6.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    jump_label: Fix the fix, brown paper bags galore

to the 6.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     jump_label-fix-the-fix-brown-paper-bags-galore.patch
and it can be found in the queue-6.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 5f26cebd62e22fd6022ca20f0ac44ecad8b381cd
Author: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Date:   Wed Jul 31 12:43:21 2024 +0200

    jump_label: Fix the fix, brown paper bags galore
    
    [ Upstream commit 224fa3552029a3d14bec7acf72ded8171d551b88 ]
    
    Per the example of:
    
      !atomic_cmpxchg(&key->enabled, 0, 1)
    
    the inverse was written as:
    
      atomic_cmpxchg(&key->enabled, 1, 0)
    
    except of course, that while !old is only true for old == 0, old is
    true for everything except old == 0.
    
    Fix it to read:
    
      atomic_cmpxchg(&key->enabled, 1, 0) == 1
    
    such that only the 1->0 transition returns true and goes on to disable
    the keys.
    
    Fixes: 83ab38ef0a0b ("jump_label: Fix concurrency issues in static_key_slow_dec()")
    Reported-by: Darrick J. Wong <djwong@xxxxxxxxxx>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
    Tested-by: Darrick J. Wong <djwong@xxxxxxxxxx>
    Link: https://lkml.kernel.org/r/20240731105557.GY33588@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/kernel/jump_label.c b/kernel/jump_label.c
index 1f05a19918f47..c6ac0d0377d72 100644
--- a/kernel/jump_label.c
+++ b/kernel/jump_label.c
@@ -231,7 +231,7 @@ void static_key_disable_cpuslocked(struct static_key *key)
 	}
 
 	jump_label_lock();
-	if (atomic_cmpxchg(&key->enabled, 1, 0))
+	if (atomic_cmpxchg(&key->enabled, 1, 0) == 1)
 		jump_label_update(key);
 	jump_label_unlock();
 }
@@ -284,7 +284,7 @@ static void __static_key_slow_dec_cpuslocked(struct static_key *key)
 		return;
 
 	guard(mutex)(&jump_label_mutex);
-	if (atomic_cmpxchg(&key->enabled, 1, 0))
+	if (atomic_cmpxchg(&key->enabled, 1, 0) == 1)
 		jump_label_update(key);
 	else
 		WARN_ON_ONCE(!static_key_slow_try_dec(key));




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux