提交 469c1d65 编写于 作者: C Chen Zhongjin 提交者: sanglipeng

driver core: Fix test_async_probe_init saves device in wrong array

stable inclusion
from stable-v5.10.166
commit 704a423c9379a27edf14a88313f1c26ff7a3dc04
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I7TH9O

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=704a423c9379a27edf14a88313f1c26ff7a3dc04

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

[ Upstream commit 9be182da ]

In test_async_probe_init, second set of asynchronous devices are saved
in sync_dev[sync_id], which should be async_dev[async_id].
This makes these devices not unregistered when exit.

> modprobe test_async_driver_probe && \
> modprobe -r test_async_driver_probe && \
> modprobe test_async_driver_probe
 ...
> sysfs: cannot create duplicate filename '/devices/platform/test_async_driver.4'
> kobject_add_internal failed for test_async_driver.4 with -EEXIST,
  don't try to register things with the same name in the same directory.

Fixes: 57ea974f ("driver core: Rewrite test_async_driver_probe to cover serialization and NUMA affinity")
Signed-off-by: NChen Zhongjin <chenzhongjin@huawei.com>
Link: https://lore.kernel.org/r/20221125063541.241328-1-chenzhongjin@huawei.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: Nsanglipeng <sanglipeng1@jd.com>
上级 f47ac9c2
...@@ -146,7 +146,7 @@ static int __init test_async_probe_init(void) ...@@ -146,7 +146,7 @@ static int __init test_async_probe_init(void)
calltime = ktime_get(); calltime = ktime_get();
for_each_online_cpu(cpu) { for_each_online_cpu(cpu) {
nid = cpu_to_node(cpu); nid = cpu_to_node(cpu);
pdev = &sync_dev[sync_id]; pdev = &async_dev[async_id];
*pdev = test_platform_device_register_node("test_async_driver", *pdev = test_platform_device_register_node("test_async_driver",
async_id, async_id,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册