From patchwork Wed Nov 13 20:29:01 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alex Deucher X-Patchwork-Id: 3179611 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 7830EC045B for ; Wed, 13 Nov 2013 20:29:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B689520824 for ; Wed, 13 Nov 2013 20:29:31 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id B7ACD2081F for ; Wed, 13 Nov 2013 20:29:30 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 87B34FB274; Wed, 13 Nov 2013 12:29:27 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qa0-f45.google.com (mail-qa0-f45.google.com [209.85.216.45]) by gabe.freedesktop.org (Postfix) with ESMTP id 340FDFB274 for ; Wed, 13 Nov 2013 12:29:25 -0800 (PST) Received: by mail-qa0-f45.google.com with SMTP id hu16so4105655qab.4 for ; Wed, 13 Nov 2013 12:29:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=8bAc7O1/hVeeCy/E+kw2Z/8CigvwkgUI84C3Laah7e0=; b=AxWwYv90tBvyMRVBTCIAxb68Fg3V4Icrh5c5/dKMhJ2QqTk6DY97rDCgFsP8Jw/qo0 eTv366HWVTotaT6Edp0rGNSstbyrBINNZiQPHJaqOuyfcCOO97D5z4RWqUsLynKMPBMX 5JiSlEQPYlCyggxjTYmAstF2DHWLphDtfpJ6I8/jjvbe9aaV7M+Q1n/w2Fk6ZFkkqiqW UpGsao8L3LlTJF4UOxWTOigCu2JNhdapOw4+577W4hNeLTauYqBZPdT09k3MyNnVJiyy WQIfALU0S8WnS/JIvTr+izxNRgbqq12sLCUpIzL8nmEC6s2roz58zFhJ13HnxxphARZp UKuQ== X-Received: by 10.229.127.74 with SMTP id f10mr68677206qcs.16.1384374563174; Wed, 13 Nov 2013 12:29:23 -0800 (PST) Received: from localhost.localdomain (static-74-96-105-49.washdc.fios.verizon.net. [74.96.105.49]) by mx.google.com with ESMTPSA id u3sm76292841qej.8.2013.11.13.12.29.22 for (version=TLSv1.2 cipher=AES128-GCM-SHA256 bits=128/128); Wed, 13 Nov 2013 12:29:22 -0800 (PST) From: Alex Deucher To: dri-devel@lists.freedesktop.org Subject: [PATCH] drm/radeon/vm: don't attempt to update ptes if ib allocation fails Date: Wed, 13 Nov 2013 15:29:01 -0500 Message-Id: <1384374541-28696-1-git-send-email-alexander.deucher@amd.com> X-Mailer: git-send-email 1.8.3.1 Cc: Alex Deucher , stable@vger.kernel.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If we fail to allocate an indirect buffer (ib) when updating the ptes, return an error instead of trying to use the ib. Avoids a null pointer dereference. Bug: https://bugzilla.kernel.org/show_bug.cgi?id=58621 Signed-off-by: Alex Deucher Cc: stable@vger.kernel.org Reviewed-by: Christian König --- drivers/gpu/drm/radeon/radeon_gart.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/radeon/radeon_gart.c b/drivers/gpu/drm/radeon/radeon_gart.c index cd7489b..3044e50 100644 --- a/drivers/gpu/drm/radeon/radeon_gart.c +++ b/drivers/gpu/drm/radeon/radeon_gart.c @@ -1209,6 +1209,8 @@ int radeon_vm_bo_update_pte(struct radeon_device *rdev, return -ENOMEM; r = radeon_ib_get(rdev, R600_RING_TYPE_DMA_INDEX, &ib, NULL, ndw * 4); + if (r) + return r; ib.length_dw = 0; r = radeon_vm_update_pdes(rdev, vm, &ib, bo_va->soffset, bo_va->eoffset);