From patchwork Wed Jan 16 23:37:41 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 1993811 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 B37A43FC85 for ; Thu, 17 Jan 2013 00:10:03 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6C6ECE5C11 for ; Wed, 16 Jan 2013 16:10:03 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org X-Greylist: delayed 456 seconds by postgrey-1.32 at gabe; Wed, 16 Jan 2013 15:45:34 PST Received: from g1t0028.austin.hp.com (g1t0028.austin.hp.com [15.216.28.35]) by gabe.freedesktop.org (Postfix) with ESMTP id 98AB3E6B53 for ; Wed, 16 Jan 2013 15:45:34 -0800 (PST) Received: from g1t0038.austin.hp.com (g1t0038.austin.hp.com [16.236.32.44]) by g1t0028.austin.hp.com (Postfix) with ESMTP id 769111C476; Wed, 16 Jan 2013 23:37:57 +0000 (UTC) Received: from [10.152.0.194] (swa01cs006-da01.atlanta.hp.com [16.114.29.156]) by g1t0038.austin.hp.com (Postfix) with ESMTP id E30903002D; Wed, 16 Jan 2013 23:37:45 +0000 (UTC) Message-ID: <1358379461.7243.6.camel@lorien2> Subject: [PATCH] drm/radeon: fix NULL pointer dereference in UMS mode From: Shuah Khan To: ihadzic@research.bell-labs.com, airlied@linux.ie, deathsimple@vodafone.de, jglisse@redhat.com, airlied@redhat.com, alexander.deucher@amd.com Date: Wed, 16 Jan 2013 16:37:41 -0700 Organization: ISS-Linux X-Mailer: Evolution 3.2.3-0ubuntu6 Mime-Version: 1.0 X-Mailman-Approved-At: Wed, 16 Jan 2013 16:08:53 -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 In UMS mode parser->rdev is NULL, so dereferencing will cause an oops. Upstream commit-id: ff4bd0827764e10a428a9d39e6814c5478863f94 Stable tree: 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/radeon_cs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon_cs.c b/drivers/gpu/drm/radeon/radeon_cs.c index 396baba..45151c4 100644 --- a/drivers/gpu/drm/radeon/radeon_cs.c +++ b/drivers/gpu/drm/radeon/radeon_cs.c @@ -279,7 +279,7 @@ int radeon_cs_parser_init(struct radeon_cs_parser *p, void *data) p->chunks[p->chunk_ib_idx].length_dw); return -EINVAL; } - if ((p->rdev->flags & RADEON_IS_AGP)) { + if (p->rdev && (p->rdev->flags & RADEON_IS_AGP)) { p->chunks[p->chunk_ib_idx].kpage[0] = kmalloc(PAGE_SIZE, GFP_KERNEL); p->chunks[p->chunk_ib_idx].kpage[1] = kmalloc(PAGE_SIZE, GFP_KERNEL); if (p->chunks[p->chunk_ib_idx].kpage[0] == NULL || @@ -583,7 +583,8 @@ static int radeon_cs_update_pages(struct radeon_cs_parser *p, int pg_idx) struct radeon_cs_chunk *ibc = &p->chunks[p->chunk_ib_idx]; int i; int size = PAGE_SIZE; - bool copy1 = (p->rdev->flags & RADEON_IS_AGP) ? false : true; + bool copy1 = (p->rdev && (p->rdev->flags & RADEON_IS_AGP)) ? + false : true; for (i = ibc->last_copied_page + 1; i < pg_idx; i++) { if (DRM_COPY_FROM_USER(p->ib.ptr + (i * (PAGE_SIZE/4)),