Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp321488ybl; Tue, 13 Aug 2019 21:45:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqwZJ6S+VKucgEwDvQ/pWCfpm68ns10zNbsVD870zPqqNGL+PTOEROSx4R68VTgV5XPn7kI2 X-Received: by 2002:a17:90a:2c9:: with SMTP id d9mr1132317pjd.134.1565757902439; Tue, 13 Aug 2019 21:45:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565757902; cv=none; d=google.com; s=arc-20160816; b=lPwk9v2FlmCJ+4u1Gw2/kEx0xFoAAk5bnVs5z8q7O+k8q8CtH9rKsrvh+VL7bHe49h dtIVp6fJoOqNcKl18oFJjM3olx/QjOiDCSGS57+YVxMvfHaHQWwW/Xi8BzI9gMFZQuqE kooKExlFNaXo5xPh8qYrmG1gv1TIdfGZ4g1GvzJHuwZuJ4eO6uOGbS9dbx7XiEbFdkAT PEnb1ToBBSlycNMYB2nsZEI9J1Q3FhMaZic+EbEnxcSoS4+YNE2My3uvoMOXBjoNlC8u HsD/rkVb1RtIMm1flUnFPj4wXCTBJHboCjYEwYbiapxPGbc4A3JyCpvHk02crXDHwSwD Sl7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=wgqGih6bPTF68flNrZ+a7ex3JNT1mb6mYDFqWXV8uXY=; b=m677uccC//nLStjCcgqYUh1qTqOYwr1rCRLxxNgilotGfU1Bkpx9287vkvjBeENo9F qC2vQyDQn8OZwVGZM+UVWGp/m54iERLVjw51PC1klvh5j/HsBmWGyAOACZy8VcpBVZNe 6kf5tantWLpIzqCSkC68n3zY9EcOupyg6XEO44Zmq6Om7ga7ick7yW255Ag9HSQ4+9ik vgGQCPDfT0unDVpwq+V1CBtrZbGIKBnFBcanaAeKwy0RPQwKpdasJw4y/kxWdcqkaxft Xzf2cQ7hpTm/suIrpdgUpP2G8lcPU8kLaXz0SL/IJ+9H9epcT5VrLd5/AnWOFjRC0+6K Oibg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i3si61760971pld.357.2019.08.13.21.44.46; Tue, 13 Aug 2019 21:45:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726990AbfHNEoL (ORCPT + 99 others); Wed, 14 Aug 2019 00:44:11 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:4256 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725262AbfHNEoL (ORCPT ); Wed, 14 Aug 2019 00:44:11 -0400 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 5C997CF11AF697350998; Wed, 14 Aug 2019 12:44:05 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.439.0; Wed, 14 Aug 2019 12:43:59 +0800 From: Wei Yongjun To: Rob Herring , Tomeu Vizoso , David Airlie , Daniel Vetter CC: Wei Yongjun , , , Subject: [PATCH -next] drm/panfrost: Fix missing unlock on error in panfrost_mmu_map_fault_addr() Date: Wed, 14 Aug 2019 04:48:14 +0000 Message-ID: <20190814044814.102294-1-weiyongjun1@huawei.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7BIT X-Originating-IP: [10.175.113.25] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add the missing unlock before return from function panfrost_mmu_map_fault_addr() in the error handling case. Fixes: 187d2929206e ("drm/panfrost: Add support for GPU heap allocations") Signed-off-by: Wei Yongjun --- drivers/gpu/drm/panfrost/panfrost_mmu.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/panfrost/panfrost_mmu.c b/drivers/gpu/drm/panfrost/panfrost_mmu.c index 2ed411f09d80..06f1a563e940 100644 --- a/drivers/gpu/drm/panfrost/panfrost_mmu.c +++ b/drivers/gpu/drm/panfrost/panfrost_mmu.c @@ -327,14 +327,17 @@ int panfrost_mmu_map_fault_addr(struct panfrost_device *pfdev, int as, u64 addr) if (!bo->base.pages) { bo->sgts = kvmalloc_array(bo->base.base.size / SZ_2M, sizeof(struct sg_table), GFP_KERNEL | __GFP_ZERO); - if (!bo->sgts) + if (!bo->sgts) { + mutex_unlock(&bo->base.pages_lock); return -ENOMEM; + } pages = kvmalloc_array(bo->base.base.size >> PAGE_SHIFT, sizeof(struct page *), GFP_KERNEL | __GFP_ZERO); if (!pages) { kfree(bo->sgts); bo->sgts = NULL; + mutex_unlock(&bo->base.pages_lock); return -ENOMEM; } bo->base.pages = pages;