From patchwork Fri Jun 10 21:40:47 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jesper Juhl X-Patchwork-Id: 871012 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p5AMep9d032283 for ; Fri, 10 Jun 2011 22:41:17 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8B6C59EAFA for ; Fri, 10 Jun 2011 15:40:50 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Fri, 10 Jun 2011 22:41:17 +0000 (UTC) X-Greylist: delayed 388 seconds by postgrey-1.31 at gabe; Fri, 10 Jun 2011 14:55:40 PDT Received: from swampdragon.chaosbits.net (swampdragon.chaosbits.net [90.184.90.115]) by gabe.freedesktop.org (Postfix) with ESMTP id BD8439E7C2 for ; Fri, 10 Jun 2011 14:55:40 -0700 (PDT) Received: by swampdragon.chaosbits.net (Postfix, from userid 1000) id 436BB9403D; Fri, 10 Jun 2011 23:40:48 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by swampdragon.chaosbits.net (Postfix) with ESMTP id 33DF99403B; Fri, 10 Jun 2011 23:40:48 +0200 (CEST) Date: Fri, 10 Jun 2011 23:40:47 +0200 (CEST) From: Jesper Juhl To: linux-kernel@vger.kernel.org Subject: [PATCH] i915: Don't leak in i915_gem_shmem_pread_slow().. Message-ID: User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 X-Mailman-Approved-At: Fri, 10 Jun 2011 15:40:42 -0700 Cc: dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org It seems to me that we are leaking 'user_pages' in drivers/gpu/drm/i915/i915_gem.c::i915_gem_shmem_pread_slow() if read_cache_page_gfp() fails. Signed-off-by: Jesper Juhl --- i915_gem.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) Untested patch - user be warned. diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 12d3257..4df3272 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -465,8 +465,10 @@ i915_gem_shmem_pread_slow(struct drm_device *dev, page = read_cache_page_gfp(mapping, offset >> PAGE_SHIFT, GFP_HIGHUSER | __GFP_RECLAIMABLE); - if (IS_ERR(page)) + if (IS_ERR(page)) { + drm_free_large(user_pages); return PTR_ERR(page); + } if (do_bit17_swizzling) { slow_shmem_bit17_copy(page,