提交 4224f779 编写于 作者: G Gu Zitao 提交者: Zheng Zengkai

sw64: iommu: fix a bug in calling 'alloc_pages_node'

Sunway inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I4SPZD
CVE: NA

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

The node id of hose is used to denote topological physical id of PCI
host bridge, however one may start up the machine by command line
'numa=off' to switch off NUMA system, and this case may raise exception
on the node id passed to alloc_pages_node, so let's use dev_to_node(dev)
instead and ensure the correctness of the parameter passed in.

Signed-off-by: Gu Zitao <guzitao@wxiat.com> #openEuler_contributor
Signed-off-by: NLaibin Qiu <qiulaibin@huawei.com>
Reviewed-by: NHanjun Guo <guohanjun@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 5d31a85b
......@@ -1044,7 +1044,7 @@ static void *sunway_alloc_coherent(struct device *dev,
gfp &= ~GFP_DMA;
try_again:
page = alloc_pages_node(hose->node, gfp | __GFP_ZERO, get_order(size));
page = alloc_pages_node(dev_to_node(dev), gfp | __GFP_ZERO, get_order(size));
cpu_addr = page_address(page);
if (!cpu_addr) {
pr_info
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册