linux/drivers/gpu
Ben Hutchings c8c5f27c65 drm/msm: Fix possible null dereference on failure of get_pages()
commit 3976626ea3 upstream.

Commit 62e3a3e342 changed get_pages() to initialise
msm_gem_object::pages before trying to initialise msm_gem_object::sgt,
so that put_pages() would properly clean up pages in the failure
case.

However, this means that put_pages() now needs to check that
msm_gem_object::sgt is not null before trying to clean it up, and
this check was only applied to part of the cleanup code.  Move
it all into the conditional block.  (Strictly speaking we don't
need to make the kfree() conditional, but since we can't avoid
checking for null ourselves we may as well do so.)

Fixes: 62e3a3e342 ("drm/msm: fix leak in failed get_pages")
Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
Reviewed-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
History 2018-10-21 08:45:32 +01:00
..
drm drm/msm: Fix possible null dereference on failure of get_pages() 2018-10-21 08:45:32 +01:00
host1x gpu: host1x: Rename internal functions for clarity 2014-06-05 23:10:30 +02:00
ipu-v3 Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux 2014-06-12 11:32:30 -07:00
vga vgaarb: fix signal handling in vga_get() 2016-01-18 22:27:27 +00:00
Makefile gpu: ipu-v3: Move i.MX IPUv3 core driver out of staging 2014-06-04 11:06:52 +02:00