提交 287958ca 编写于 作者: J Joerg Roedel 提交者: Yang Yingliang

iommu/mediatek: Use correct fwspec in mtk_iommu_add_device()

mainline inclusion
from mainline-v5.0-rc1
commit da5d2748
category:bugfix
bugzilla:NA
CVE:NA

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

The mtk_iommu_add_device() function keeps the fwspec in an
on-stack pointer and calls mtk_iommu_create_mapping(), which
might change its source, dev->iommu_fwspec. This causes the
on-stack pointer to be obsoleted and the device
initialization to fail. Update the on-stack fwspec pointer
after mtk_iommu_create_mapping() has been called.
Reported-by: NFrank Wunderlich <frank-w@public-files.de>
Fixes: a9bf2eec ('iommu/mediatek: Use helper functions to access dev->iommu_fwspec')
Tested-by: NFrank Wunderlich <frank-w@public-files.de>
Signed-off-by: NJoerg Roedel <jroedel@suse.de>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Reviewed-by: NHanjun Guo <guohanjun@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 f41b91bb
...@@ -440,6 +440,10 @@ static int mtk_iommu_add_device(struct device *dev) ...@@ -440,6 +440,10 @@ static int mtk_iommu_add_device(struct device *dev)
iommu_spec.args_count = count; iommu_spec.args_count = count;
mtk_iommu_create_mapping(dev, &iommu_spec); mtk_iommu_create_mapping(dev, &iommu_spec);
/* dev->iommu_fwspec might have changed */
fwspec = dev_iommu_fwspec_get(dev);
of_node_put(iommu_spec.np); of_node_put(iommu_spec.np);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册