mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-27 03:10:12 +00:00
drm/tegra: gem: Do not try to dereference ERR_PTR()
[ Upstream commit cb7e1abc2c
]
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: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
2ab0a30f4f
commit
6f530e22fd
1 changed files with 1 additions and 0 deletions
|
@ -88,6 +88,7 @@ static struct host1x_bo_mapping *tegra_bo_pin(struct device *dev, struct host1x_
|
|||
if (IS_ERR(map->sgt)) {
|
||||
dma_buf_detach(buf, map->attach);
|
||||
err = PTR_ERR(map->sgt);
|
||||
map->sgt = NULL;
|
||||
goto free;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue