lcoking/rwsem: Add missing ACQUIRE to read_slowpath sleep loop
mainline inclusion
from mainline-5.3-rc2
commit 99143f82a255e7f054bead8443462fae76dd829e
category: bugfix
bugzilla: 20006
CVE: NA
-------------------------------------------------
While reviewing another read_slowpath patch, both Will and I noticed
another missing ACQUIRE, namely:
X = 0;
CPU0 CPU1
rwsem_down_read()
for (;;) {
set_current_state(TASK_UNINTERRUPTIBLE);
X = 1;
rwsem_up_write();
rwsem_mark_wake()
atomic_long_add(adjustment, &sem->count);
smp_store_release(&waiter->task, NULL);
if (!waiter.task)
break;
...
}
r = X;
Allows 'r == 0'.
Reported-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
Reported-by: NWill Deacon <will@kernel.org>
Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: NWill Deacon <will@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Fixes: 1da177e4 ("Linux-2.6.12-rc2")
Signed-off-by: NIngo Molnar <mingo@kernel.org>
Conflicts: kernel/locking/rwsem.c
[yyl: rwsem_down_read_slowpath() is refactor __rwsem_down_read_failed_common()]
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
Reviewed-by: NHanjun Guo <guohanjun@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
Showing
想要评论请 注册 或 登录