]> git.baikalelectronics.ru Git - kernel.git/commit
drm/tegra: gem: Do not try to dereference ERR_PTR()
authorThierry Reding <treding@nvidia.com>
Fri, 6 May 2022 13:52:49 +0000 (15:52 +0200)
committerThierry Reding <treding@nvidia.com>
Fri, 6 May 2022 13:52:49 +0000 (15:52 +0200)
commita02bb625d803dbb58b18d3f7890b8cff90c6f74e
treeb3f216cb3832ee978ab7912ed42ff4b35afa25d0
parent87dfebf429bd6f11ce83c8042c0fce062143b36b
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>
drivers/gpu/drm/tegra/gem.c