drm/aperture: Fix missing unlock on error in devm_aperture_acquire()
Subsystems (2)
PATCH 1/1 drm/aperture: Fix missing unlock on error in devm_aperture_acquire()
Add the missing unlock before return from function devm_aperture_acquire() in the error handling case.
Reported-by Hulk Robot <[email protected]>
Signed-off-by Zou Wei <[email protected]>
--- drivers/gpu/drm/drm_aperture.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_aperture.c +6 -2
@@ -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;
Signature · 1 line
2.6.2
Thomas Zimmermann
maintainerHi
Am 13.05.21 um 10:46 schrieb Zou Wei:
Quoted 5 lines
Add the missing unlock before return from function
devm_aperture_acquire()in the error handling case.Reported-by Hulk Robot <[email protected]>Signed-off-by Zou Wei <[email protected]>
I added a Fixes tag and queued up the patch for drm-misc-next. Thanks!
Best regards
Thomas
Quoted 29 lines
--- drivers/gpu/drm/drm_aperture.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)drivers/gpu/drm/drm_aperture.c +6
-2@@ -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;
Signature · 6 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Felix Imendörffer