diff options
author | Thierry Reding <treding@nvidia.com> | 2022-05-06 15:52:49 +0200 |
---|---|---|
committer | Thierry Reding <treding@nvidia.com> | 2022-05-06 15:52:49 +0200 |
commit | cb7e1abc2c73633e1eefa168ab2dad6e838899c9 (patch) | |
tree | b3f216cb3832ee978ab7912ed42ff4b35afa25d0 /drivers/gpu | |
parent | drm/tegra: vic: Fix unused-function warnings (diff) | |
download | linux-cb7e1abc2c73633e1eefa168ab2dad6e838899c9.tar.xz linux-cb7e1abc2c73633e1eefa168ab2dad6e838899c9.zip |
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: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/tegra/gem.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/gpu/drm/tegra/gem.c b/drivers/gpu/drm/tegra/gem.c index 0063403ab5e1..7c7dd84e6db8 100644 --- a/drivers/gpu/drm/tegra/gem.c +++ b/drivers/gpu/drm/tegra/gem.c @@ -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; } |