提交 f48b53a8 编写于 作者: E Eric Auger 提交者: Xie XiuQi

iommu/vt-d: Fix leak in intel_pasid_alloc_table on error path

mainline inclusion
from mainline-v5.2-rc1
commit dca4d60f5f8c9263f8f66724fa4750abd32d8db0
category: bugfix
bugzilla: 15933
CVE: NA

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

If alloc_pages_node() fails, pasid_table is leaked. Free it.

Fixes: cc580e41 ("iommu/vt-d: Per PCI device pasid table interfaces")
Signed-off-by: NEric Auger <eric.auger@redhat.com>
Signed-off-by: NJoerg Roedel <jroedel@suse.de>
Signed-off-by: NZhen Lei <thunder.leizhen@huawei.com>
Reviewed-by: NHanjun Guo <guohanjun@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 08218704
......@@ -149,8 +149,10 @@ int intel_pasid_alloc_table(struct device *dev)
pages = alloc_pages_node(info->iommu->node,
GFP_ATOMIC | __GFP_ZERO,
order);
if (!pages)
if (!pages) {
kfree(pasid_table);
return -ENOMEM;
}
pasid_table->table = page_address(pages);
pasid_table->order = order;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册