linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Zou Wei <zou_wei@huawei.com>
To: <maarten.lankhorst@linux.intel.com>, <mripard@kernel.org>,
	<tzimmermann@suse.de>, <airlied@linux.ie>, <daniel@ffwll.ch>
Cc: <dri-devel@lists.freedesktop.org>, <linux-kernel@vger.kernel.org>,
	Zou Wei <zou_wei@huawei.com>
Subject: [PATCH -next] drm/aperture: Fix missing unlock on error in devm_aperture_acquire()
Date: Thu, 13 May 2021 16:46:04 +0800	[thread overview]
Message-ID: <1620895564-52367-1-git-send-email-zou_wei@huawei.com> (raw)

Add the missing unlock before return from function devm_aperture_acquire()
in the error handling case.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zou Wei <zou_wei@huawei.com>
---
 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


             reply	other threads:[~2021-05-13  8:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-13  8:46 Zou Wei [this message]
2021-05-13 13:08 ` [PATCH -next] drm/aperture: Fix missing unlock on error in devm_aperture_acquire() Thomas Zimmermann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1620895564-52367-1-git-send-email-zou_wei@huawei.com \
    --to=zou_wei@huawei.com \
    --cc=airlied@linux.ie \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).