In the Linux kernel, the following vulnerability has been resolved: locking/rt: Fix the incorrect RCU protection in rtspinunlock() rtspinunlock() releases the RCU protection before unlocking the lock. That opens the door for the following UAF scenario: T1 T2 spinlock(&p->lock); rcureadlock(); invalidate(p); p = rcudereference(ptr); rcuassignpointer(ptr, NULL); if (!p) return; spinunlock(&p->lock); spinlock(&p->lock) lock(&lock->lock); rcureadlock(); kfreercu(p); rcureadunlock(); .... spinunlock(&p->lock) rcureadunlock(); // Ends grace period rcudobatch() kfree(p); UAF -> rtmutexcmpxchgrelease(&lock->lock...) Regular spinlocks keep preemption disabled accross the unlock operation, which provides full RCU protection, but the RT substitution fails to resemble that. Same applies for the rwlock substitution. Move the rcureadunlock() invocation past the unlock operations to match the non-RT semantics. This makes it asymmetric vs. rtxxxlock(), but that's harmless as the caller needs to hold RCU read lock across the lock operation. The migrateenable() call stays before the unlock operation because there is no per CPU operation in the unlock path which would require migration to be kept disabled.