All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] drm/aperture: Fix missing unlock on error in devm_aperture_acquire()
@ 2021-05-13  8:46 ` Zou Wei
  0 siblings, 0 replies; 4+ messages in thread
From: Zou Wei @ 2021-05-13  8:46 UTC (permalink / raw)
  To: maarten.lankhorst, mripard, tzimmermann, airlied, daniel
  Cc: dri-devel, linux-kernel, Zou Wei

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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH -next] drm/aperture: Fix missing unlock on error in devm_aperture_acquire()
@ 2021-05-13  8:46 ` Zou Wei
  0 siblings, 0 replies; 4+ messages in thread
From: Zou Wei @ 2021-05-13  8:46 UTC (permalink / raw)
  To: maarten.lankhorst, mripard, tzimmermann, airlied, daniel
  Cc: Zou Wei, linux-kernel, dri-devel

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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH -next] drm/aperture: Fix missing unlock on error in devm_aperture_acquire()
  2021-05-13  8:46 ` Zou Wei
@ 2021-05-13 13:08   ` Thomas Zimmermann
  -1 siblings, 0 replies; 4+ messages in thread
From: Thomas Zimmermann @ 2021-05-13 13:08 UTC (permalink / raw)
  To: Zou Wei, maarten.lankhorst, mripard, airlied, daniel
  Cc: dri-devel, linux-kernel


[-- Attachment #1.1: Type: text/plain, Size: 1471 bytes --]

Hi

Am 13.05.21 um 10:46 schrieb Zou Wei:
> 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>

I added a Fixes tag and queued up the patch for drm-misc-next. Thanks!

Best regards
Thomas

> ---
>   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;
> 

-- 
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


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH -next] drm/aperture: Fix missing unlock on error in devm_aperture_acquire()
@ 2021-05-13 13:08   ` Thomas Zimmermann
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Zimmermann @ 2021-05-13 13:08 UTC (permalink / raw)
  To: Zou Wei, maarten.lankhorst, mripard, airlied, daniel
  Cc: linux-kernel, dri-devel


[-- Attachment #1.1: Type: text/plain, Size: 1471 bytes --]

Hi

Am 13.05.21 um 10:46 schrieb Zou Wei:
> 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>

I added a Fixes tag and queued up the patch for drm-misc-next. Thanks!

Best regards
Thomas

> ---
>   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;
> 

-- 
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


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-05-13 13:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-13  8:46 [PATCH -next] drm/aperture: Fix missing unlock on error in devm_aperture_acquire() Zou Wei
2021-05-13  8:46 ` Zou Wei
2021-05-13 13:08 ` Thomas Zimmermann
2021-05-13 13:08   ` Thomas Zimmermann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.