提交 3ffbe623 编写于 作者: M Matthew Wilcox (Oracle) 提交者: Zheng Zengkai

idr test suite: Take RCU read lock in idr_find_test_1

stable inclusion
from stable-5.10.31
commit 9a7552daa93bf38f6975cb47f6f726d3e2b81a60
bugzilla: 51792

--------------------------------

[ Upstream commit 70358641 ]

When run on a single CPU, this test would frequently access already-freed
memory.  Due to timing, this bug never showed up on multi-CPU tests.
Reported-by: NChris von Recklinghausen <crecklin@redhat.com>
Signed-off-by: NMatthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Acked-by: N  Weilong Chen <chenweilong@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 8e33899d
......@@ -306,11 +306,15 @@ void idr_find_test_1(int anchor_id, int throbber_id)
BUG_ON(idr_alloc(&find_idr, xa_mk_value(anchor_id), anchor_id,
anchor_id + 1, GFP_KERNEL) != anchor_id);
rcu_read_lock();
do {
int id = 0;
void *entry = idr_get_next(&find_idr, &id);
rcu_read_unlock();
BUG_ON(entry != xa_mk_value(id));
rcu_read_lock();
} while (time(NULL) < start + 11);
rcu_read_unlock();
pthread_join(throbber, NULL);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册