Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'locking_urgent_for_v5.12' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull locking fix from Borislav Petkov:
"Fix ordering in the queued writer lock's slowpath"

* tag 'locking_urgent_for_v5.12' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
locking/qrwlock: Fix ordering in queued_write_lock_slowpath()

+4 -3
+4 -3
kernel/locking/qrwlock.c
··· 60 60 */ 61 61 void queued_write_lock_slowpath(struct qrwlock *lock) 62 62 { 63 + int cnts; 64 + 63 65 /* Put the writer into the wait queue */ 64 66 arch_spin_lock(&lock->wait_lock); 65 67 ··· 75 73 76 74 /* When no more readers or writers, set the locked flag */ 77 75 do { 78 - atomic_cond_read_acquire(&lock->cnts, VAL == _QW_WAITING); 79 - } while (atomic_cmpxchg_relaxed(&lock->cnts, _QW_WAITING, 80 - _QW_LOCKED) != _QW_WAITING); 76 + cnts = atomic_cond_read_relaxed(&lock->cnts, VAL == _QW_WAITING); 77 + } while (!atomic_try_cmpxchg_acquire(&lock->cnts, &cnts, _QW_LOCKED)); 81 78 unlock: 82 79 arch_spin_unlock(&lock->wait_lock); 83 80 }