From patchwork Thu Oct 22 16:40:21 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alex Deucher X-Patchwork-Id: 7465901 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id BF0279F30B for ; Thu, 22 Oct 2015 16:40:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F286D20861 for ; Thu, 22 Oct 2015 16:40:34 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id B656520858 for ; Thu, 22 Oct 2015 16:40:33 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 648AD8912F; Thu, 22 Oct 2015 09:40:31 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-yk0-f173.google.com (mail-yk0-f173.google.com [209.85.160.173]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5E92C8912F for ; Thu, 22 Oct 2015 09:40:30 -0700 (PDT) Received: by ykdr3 with SMTP id r3so88461627ykd.1 for ; Thu, 22 Oct 2015 09:40:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:mime-version:content-type :content-transfer-encoding; bh=YS1v1ms/oKviEzNnbwU98rYrQOlPAE2gDSMBA6bAjjY=; b=vC8jqnmX++s214+akK2s4hVy9JG5gVY+eR4N49wcmYaXrFg0Ll2atD4az+BY90b3fE ife/Mz/H8/kq2KYZh4o4E9LEml6VRHr+/dKCoW+C8XTTPY2SkKAM/3Acg5WQfMAL4oOH bA2RxaBBpx1GdoLq2FtbEgzB2UaQRurzf3L/mp7T4X7VZikRBMB273c+shN+EavBnjhM fAuFoehkzK60j4pxUUtvdi/hzn3v8ccm26G8ZFmT5ykwIliftBFNWkHiLdwNvHa1YG7o MU7Tq6D/zDG5iXAR1GtG+2ce2ecTTC+GvjYGYjI08N3KB0taLDTnakfZU8739uR6lnpv q70Q== X-Received: by 10.13.195.5 with SMTP id f5mr11858856ywd.203.1445532029513; Thu, 22 Oct 2015 09:40:29 -0700 (PDT) Received: from localhost.localdomain (static-74-96-105-49.washdc.fios.verizon.net. [74.96.105.49]) by smtp.gmail.com with ESMTPSA id q4sm10378921ywf.32.2015.10.22.09.40.28 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Oct 2015 09:40:29 -0700 (PDT) From: Alex Deucher X-Google-Original-From: Alex Deucher To: dri-devel@lists.freedesktop.org Subject: [PATCH 1/3] amdgpu: Unlock mutex if base_required is invalid Date: Thu, 22 Oct 2015 12:40:21 -0400 Message-Id: <1445532023-16778-1-git-send-email-alexander.deucher@amd.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 Cc: Tom St Denis X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 From: Tom St Denis In the function amdgpu_vamgr_find_va() the function would return without unlocking the mutex if the base_required offset was below the va managers base offset. Signed-off-by: Tom St Denis Reviewed-by: Christian König --- amdgpu/amdgpu_vamgr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/amdgpu/amdgpu_vamgr.c b/amdgpu/amdgpu_vamgr.c index 04d2881..2221da0 100644 --- a/amdgpu/amdgpu_vamgr.c +++ b/amdgpu/amdgpu_vamgr.c @@ -124,8 +124,10 @@ amdgpu_vamgr_find_va(struct amdgpu_bo_va_mgr *mgr, uint64_t size, } if (base_required) { - if (base_required < mgr->va_offset) + if (base_required < mgr->va_offset) { + pthread_mutex_unlock(&mgr->bo_va_mutex); return AMDGPU_INVALID_VA_ADDRESS; + } offset = mgr->va_offset; waste = base_required - mgr->va_offset; } else {