提交 a02ada86 编写于 作者: H Haiyang Zhang 提交者: Zheng Zengkai

PCI: hv: Add check for hyperv_initialized in init_hv_pci_drv()

stable inclusion
from stable-5.10.50
commit 998d9fefdd47ad7160b027017445684507236b9f
bugzilla: 174522 https://gitee.com/openeuler/kernel/issues/I4DNFY

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

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

[ Upstream commit 7d815f4a ]

Add check for hv_is_hyperv_initialized() at the top of
init_hv_pci_drv(), so if the pci-hyperv driver is force-loaded on non
Hyper-V platforms, the init_hv_pci_drv() will exit immediately, without
any side effects, like assignments to hvpci_block_ops, etc.
Signed-off-by: NHaiyang Zhang <haiyangz@microsoft.com>
Reported-and-tested-by: NMohammad Alqayeem <mohammad.alqyeem@nutanix.com>
Reviewed-by: NWei Liu <wei.liu@kernel.org>
Link: https://lore.kernel.org/r/1621984653-1210-1-git-send-email-haiyangz@microsoft.comSigned-off-by: NWei Liu <wei.liu@kernel.org>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Acked-by: NWeilong Chen <chenweilong@huawei.com>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 ac17c702
......@@ -3480,6 +3480,9 @@ static void __exit exit_hv_pci_drv(void)
static int __init init_hv_pci_drv(void)
{
if (!hv_is_hyperv_initialized())
return -ENODEV;
/* Set the invalid domain number's bit, so it will not be used */
set_bit(HVPCI_DOM_INVALID, hvpci_dom_map);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册