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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Russell King <rmk+kernel@xxxxxxxxxxxxxxxx>

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@xxxxxxxxxxxxxxxx>
---
 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

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel





[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux