[PATCH -next] drm/aperture: Fix missing unlock on error in devm_aperture_acquire()
Zou Wei
zou_wei at huawei.com
Thu May 13 08:46:04 UTC 2021
Add the missing unlock before return from function devm_aperture_acquire()
in the error handling case.
Reported-by: Hulk Robot <hulkci at huawei.com>
Signed-off-by: Zou Wei <zou_wei at 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
More information about the dri-devel
mailing list