提交 cb7e1abc 编写于 作者: T Thierry Reding

drm/tegra: gem: Do not try to dereference ERR_PTR()

When mapping the DMA-BUF attachment fails, map->sgt will be an ERR_PTR-
encoded error code and the cleanup code would try to free that memory,
which obviously would fail.

Zero out that pointer after extracting the error code when this happens
so that kfree() can do the right thing.
Reported-by: Nkernel test robot <lkp@intel.com>
Reported-by: NDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: NThierry Reding <treding@nvidia.com>
上级 42457494
...@@ -88,6 +88,7 @@ static struct host1x_bo_mapping *tegra_bo_pin(struct device *dev, struct host1x_ ...@@ -88,6 +88,7 @@ static struct host1x_bo_mapping *tegra_bo_pin(struct device *dev, struct host1x_
if (IS_ERR(map->sgt)) { if (IS_ERR(map->sgt)) {
dma_buf_detach(buf, map->attach); dma_buf_detach(buf, map->attach);
err = PTR_ERR(map->sgt); err = PTR_ERR(map->sgt);
map->sgt = NULL;
goto free; goto free;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册