agp/intel: Fix a memory leak on module initialisation failure
authorQiushi Wu <wu000273@umn.edu>
Fri, 22 May 2020 08:34:51 +0000 (09:34 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 19 Aug 2020 06:23:43 +0000 (08:23 +0200)
commit58f5095b4fcfd30d3b39c83a1d83e7d3aef2b1ba
tree9bf04345e5f34624bdd08627fefe5ef229b944cc
parent6478b20d0364d70f32381123d1f717eaa486ec75
agp/intel: Fix a memory leak on module initialisation failure

[ Upstream commit b975abbd382fe442713a4c233549abb90e57c22b ]

In intel_gtt_setup_scratch_page(), pointer "page" is not released if
pci_dma_mapping_error() return an error, leading to a memory leak on
module initialisation failure.  Simply fix this issue by freeing "page"
before return.

Fixes: 0e87d2b06cb46 ("intel-gtt: initialize our own scratch page")
Signed-off-by: Qiushi Wu <wu000273@umn.edu>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20200522083451.7448-1-chris@chris-wilson.co.uk
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/char/agp/intel-gtt.c