Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp193134pxj; Thu, 13 May 2021 02:39:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzz+PLQzQbWrBvxgCfS8aHci+RAFoRD1BsPIBRvls7FedBwneXXb7wC9fQBli29trp6Q9O6 X-Received: by 2002:a6b:8b06:: with SMTP id n6mr29421500iod.87.1620898781468; Thu, 13 May 2021 02:39:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620898781; cv=none; d=google.com; s=arc-20160816; b=h9PX5G3MGT2Fxn4jZia88ZIf6VRdbJv09p4WsaGJpb8xFUeagDtTuEz8W+gxPGCYG4 qN+RKIlWSs48jEzLA6xv8Q5/pRxdoIFzLBeRK3GYqmqUoJWpIlYslN7H6Q1lDmL+A+j0 C9eJjRE2hiYDSVsB2kXwJ58ClQ5JaAQcYeW4moogPNtDM0AZGgBW9qSoCo3t2SCLaGOj H3A1dP8v4drCgHcf4vgPfMQMocoi7zrOM3Mua/vCt+sdD1+ucoWEhrgEzMj+L+BDOuQF 5pLba369PE3x80L0SZfCAnBhN+lG5X2jzkWz131j6Dm3eEBJKeTTeUaFZPe1ikvDhsK3 sBFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=z5hoayRYZ4lMXT1UapgCZ4CQ+ZMCQ4yu/b1Fds1bVq8=; b=ClwmtV69K8E3Vo/Cs0FWpxqT5bYO69yQblMY+JnnDjfO84Av2XxsfA8QxG/F++mB6v v7fK5cIBeNZpolUYZyBKiyv6MjYjpw02gy6TfjtgPDyM97+4MCb64mG3F4A+X5OinghK E+blnh4G0KvyM+HhRfqv1hPbYBXEx+4iZvGijflNw6c11NaYK5+3GtIgSB2U2KkFBY7D M2qNwTI9KADukIqIMPQ5VKMpVBMJ6QDaCH+AYvoDCCRqcVvslNx9JmT8yEpKHprEh9ry AmjY0WFDQr8Nzq5x1C8V3JETBeXdBisHoOgPfRE1QV7vSQTTtov/l9ek6Qc5SYOwpi4x I0UA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t3si3224655iov.10.2021.05.13.02.39.26; Thu, 13 May 2021 02:39:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231848AbhEMIaR (ORCPT + 99 others); Thu, 13 May 2021 04:30:17 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:2060 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231305AbhEMIaP (ORCPT ); Thu, 13 May 2021 04:30:15 -0400 Received: from dggeml710-chm.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Fgl7z5w4nzWhCS; Thu, 13 May 2021 16:24:47 +0800 (CST) Received: from dggemi762-chm.china.huawei.com (10.1.198.148) by dggeml710-chm.china.huawei.com (10.3.17.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Thu, 13 May 2021 16:29:04 +0800 Received: from linux-lmwb.huawei.com (10.175.103.112) by dggemi762-chm.china.huawei.com (10.1.198.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Thu, 13 May 2021 16:29:03 +0800 From: Zou Wei To: , , , , CC: , , Zou Wei Subject: [PATCH -next] drm/aperture: Fix missing unlock on error in devm_aperture_acquire() Date: Thu, 13 May 2021 16:46:04 +0800 Message-ID: <1620895564-52367-1-git-send-email-zou_wei@huawei.com> X-Mailer: git-send-email 2.6.2 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.103.112] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggemi762-chm.china.huawei.com (10.1.198.148) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add the missing unlock before return from function devm_aperture_acquire() in the error handling case. Reported-by: Hulk Robot Signed-off-by: Zou Wei --- drivers/gpu/drm/drm_aperture.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_aperture.c b/drivers/gpu/drm/drm_aperture.c index 33bf018..9335d9d 100644 --- a/drivers/gpu/drm/drm_aperture.c +++ b/drivers/gpu/drm/drm_aperture.c @@ -164,13 +164,17 @@ static int devm_aperture_acquire(struct drm_device *dev, list_for_each(pos, &drm_apertures) { ap = container_of(pos, struct drm_aperture, lh); - if (overlap(base, end, ap->base, ap->base + ap->size)) + if (overlap(base, end, ap->base, ap->base + ap->size)) { + mutex_unlock(&drm_apertures_lock); return -EBUSY; + } } ap = devm_kzalloc(dev->dev, sizeof(*ap), GFP_KERNEL); - if (!ap) + if (!ap) { + mutex_unlock(&drm_apertures_lock); return -ENOMEM; + } ap->dev = dev; ap->base = base; -- 2.6.2