[PATCH RFC 030/111] staging: etnaviv: fix get_pages() failure path
Lucas Stach
l.stach at pengutronix.de
Thu Apr 2 08:29:32 PDT 2015
From: Russell King <rmk+kernel at 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 at arm.linux.org.uk>
---
drivers/staging/etnaviv/etnaviv_gem.c | 1 +
1 file changed, 1 insertion(+)
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);
}
--
2.1.4
More information about the dri-devel
mailing list