提交 ea3f5d26 编写于 作者: M Mika Kuoppala 提交者: Daniel Vetter

drm/i915/gtt: Don't leak scratch page on mapping error

Free the scratch page if dma mapping fails.
Signed-off-by: NMika Kuoppala <mika.kuoppala@intel.com>
Reviewed-by: NJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
上级 66c826a1
......@@ -2143,8 +2143,10 @@ static int setup_scratch_page(struct drm_device *dev)
#ifdef CONFIG_INTEL_IOMMU
dma_addr = pci_map_page(dev->pdev, page, 0, PAGE_SIZE,
PCI_DMA_BIDIRECTIONAL);
if (pci_dma_mapping_error(dev->pdev, dma_addr))
if (pci_dma_mapping_error(dev->pdev, dma_addr)) {
__free_page(page);
return -EINVAL;
}
#else
dma_addr = page_to_phys(page);
#endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册