From patchwork Thu Jan 17 20:37:05 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 1998691 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork1.kernel.org (Postfix) with ESMTP id 1C8A53FE81 for ; Fri, 18 Jan 2013 00:55:36 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E1E13E629A for ; Thu, 17 Jan 2013 16:55:35 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org X-Greylist: delayed 555 seconds by postgrey-1.32 at gabe; Thu, 17 Jan 2013 12:46:26 PST Received: from g4t0016.houston.hp.com (g4t0016.houston.hp.com [15.201.24.19]) by gabe.freedesktop.org (Postfix) with ESMTP id 63869E6D5C for ; Thu, 17 Jan 2013 12:46:26 -0800 (PST) Received: from g4t0018.houston.hp.com (g4t0018.houston.hp.com [16.234.32.27]) by g4t0016.houston.hp.com (Postfix) with ESMTP id 737ED144F5; Thu, 17 Jan 2013 20:37:10 +0000 (UTC) Received: from [10.152.1.26] (swa01cs001-da01.atlanta.hp.com [16.114.29.151]) by g4t0018.houston.hp.com (Postfix) with ESMTP id 49E2F10109; Thu, 17 Jan 2013 20:37:06 +0000 (UTC) Message-ID: <1358455025.2828.27.camel@lorien2> Subject: [PATCH] drm/radeon: fix a bogus kfree From: Shuah Khan To: alexander.deucher@amd.com, maraeo@gmail.com, airlied@redhat.com, jglisse@redhat.com, deathsimple@vodafone.de, ihadzic@research.bell-labs.com Date: Thu, 17 Jan 2013 13:37:05 -0700 Organization: ISS-Linux X-Mailer: Evolution 3.2.3-0ubuntu6 Mime-Version: 1.0 X-Mailman-Approved-At: Thu, 17 Jan 2013 16:54:28 -0800 Cc: Greg KH , stable , dri-devel@lists.freedesktop.org, shuahkhan@gmail.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list Reply-To: shuah.khan@hp.com 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 parser->chunks[.].kpage[.] is not always kmalloc-ed by the parser initialization, so parser_fini should not try to kfree it if it didn't allocate it. This patch fixes a kernel oops that can be provoked in UMS mode. Upstream commit-id: a6b7e1a02b77ab8fe8775d20a88c53d8ba55482e Tested on stable 3.7 Signed-off-by: Ilija Hadzic Signed-off-by: Alex Deucher Signed-off-by: Shuah Khan CC: stable@vger.kernel.org 3.7 --- drivers/gpu/drm/radeon/r600_cs.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/radeon/r600_cs.c b/drivers/gpu/drm/radeon/r600_cs.c index 03191a5..6858a40 100644 --- a/drivers/gpu/drm/radeon/r600_cs.c +++ b/drivers/gpu/drm/radeon/r600_cs.c @@ -2476,8 +2476,10 @@ static void r600_cs_parser_fini(struct radeon_cs_parser *parser, int error) kfree(parser->relocs); for (i = 0; i < parser->nchunks; i++) { kfree(parser->chunks[i].kdata); - kfree(parser->chunks[i].kpage[0]); - kfree(parser->chunks[i].kpage[1]); + if (parser->rdev && (parser->rdev->flags & RADEON_IS_AGP)) { + kfree(parser->chunks[i].kpage[0]); + kfree(parser->chunks[i].kpage[1]); + } } kfree(parser->chunks); kfree(parser->chunks_array);