diff mbox

[RFC,030/111] staging: etnaviv: fix get_pages() failure path

Message ID 1427988653-754-31-git-send-email-l.stach@pengutronix.de (mailing list archive)
State New, archived
Headers show

Commit Message

Lucas Stach April 2, 2015, 3:29 p.m. UTC
From: Russell King <rmk+kernel@arm.linux.org.uk>

get_pages() tries to convert a page array into a scatterlist.  If this
fails, we bail out without freeing the page array.  Add a call to
drm_gem_put_pages() to drop the reference gained in drm_gem_get_pages(),
indicating that we didn't access the pages.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
 drivers/staging/etnaviv/etnaviv_gem.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox

Patch

diff --git a/drivers/staging/etnaviv/etnaviv_gem.c b/drivers/staging/etnaviv/etnaviv_gem.c
index 18f607b6532f..9e3cd61507d1 100644
--- a/drivers/staging/etnaviv/etnaviv_gem.c
+++ b/drivers/staging/etnaviv/etnaviv_gem.c
@@ -45,6 +45,7 @@  static struct page **get_pages(struct drm_gem_object *obj)
 		etnaviv_obj->sgt = drm_prime_pages_to_sg(p, npages);
 		if (IS_ERR(etnaviv_obj->sgt)) {
 			dev_err(dev->dev, "failed to allocate sgt\n");
+			drm_gem_put_pages(obj, p, false, false);
 			return ERR_CAST(etnaviv_obj->sgt);
 		}