gfx: drv: fix resource leak in psb_gtt_map_meminfo
authorAnder Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Wed, 15 Feb 2012 13:02:14 +0000 (15:02 +0200)
committerMarkus Lehtonen <markus.lehtonen@linux.intel.com>
Tue, 3 Jul 2012 09:29:51 +0000 (12:29 +0300)
commit5789e7dcba12b39bf20eb14c92387e9026a35672
tree809cadf32dddde4ee7302f80e8352a50ca918297
parent74c2c310f2414e495eee44d681355dc1e7342933
gfx: drv: fix resource leak in psb_gtt_map_meminfo

If psb_gtt_map_meminfo was called with an already mapped handle a node
would be allocated with drm_mm_get_block_atomic in psb_gtt_mm_alloc_mem.
Later, on psb_gtt_mm_alloc_insert_mem_mapping (called by
psb_gtt_add_node), the reference to the allocated node would be
replaced by the node previously allocated for the handle, so the former
was never free'd.

This commit changes psb_gtt_map_meminfo to check for an existing node
before allocating a new one.

Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Reviewed-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
drivers/staging/mrst/drv/psb_gtt.c