This is a note to let you know that I've just added the patch titled drm/i915: Do not leak pages when freeing userptr objects to the 3.17-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: drm-i915-do-not-leak-pages-when-freeing-userptr-objects.patch and it can be found in the queue-3.17 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From c479f4383ea8940dd6f88da61798ad31feb33e51 Mon Sep 17 00:00:00 2001 From: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx> Date: Fri, 26 Sep 2014 15:05:22 +0100 Subject: drm/i915: Do not leak pages when freeing userptr objects From: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx> commit c479f4383ea8940dd6f88da61798ad31feb33e51 upstream. sg_alloc_table_from_pages() can build us a table with coalesced ranges which means we need to iterate over pages and not sg table entries when releasing page references. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx> Cc: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> Cc: "Barbalho, Rafael" <rafael.barbalho@xxxxxxxxx> Tested-by: Rafael Barbalho <rafael.barbalho@xxxxxxxxx> Reviewed-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> [danvet: Remove unused local variable sg.] Signed-off-by: Daniel Vetter <daniel.vetter@xxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/gpu/drm/i915/i915_gem_userptr.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) --- a/drivers/gpu/drm/i915/i915_gem_userptr.c +++ b/drivers/gpu/drm/i915/i915_gem_userptr.c @@ -689,16 +689,15 @@ i915_gem_userptr_get_pages(struct drm_i9 static void i915_gem_userptr_put_pages(struct drm_i915_gem_object *obj) { - struct scatterlist *sg; - int i; + struct sg_page_iter sg_iter; BUG_ON(obj->userptr.work != NULL); if (obj->madv != I915_MADV_WILLNEED) obj->dirty = 0; - for_each_sg(obj->pages->sgl, sg, obj->pages->nents, i) { - struct page *page = sg_page(sg); + for_each_sg_page(obj->pages->sgl, &sg_iter, obj->pages->nents, 0) { + struct page *page = sg_page_iter_page(&sg_iter); if (obj->dirty) set_page_dirty(page); Patches currently in stable-queue which might be from tvrtko.ursulin@xxxxxxxxx are queue-3.17/drm-i915-do-not-leak-pages-when-freeing-userptr-objects.patch queue-3.17/drm-i915-do-not-store-the-error-pointer-for-a-failed-userptr-registration.patch -- To unsubscribe from this list: send the line "unsubscribe stable" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html