All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/radeon: fix a potential NULL pointer dereference
@ 2019-09-18 16:31 Allen Pais
  2019-09-19 17:11   ` Michel Dänzer
  0 siblings, 1 reply; 3+ messages in thread
From: Allen Pais @ 2019-09-18 16:31 UTC (permalink / raw)
  To: dri-devel; +Cc: airlied, linux-kernel, amd-gfx, daniel

alloc_workqueue is not checked for errors and as a result,
a potential NULL dereference could occur.

Signed-off-by: Allen Pais <allen.pais@oracle.com>
---
 drivers/gpu/drm/radeon/radeon_display.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
index bd52f15..1a41764 100644
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -683,6 +683,10 @@ static void radeon_crtc_init(struct drm_device *dev, int index)
 	drm_mode_crtc_set_gamma_size(&radeon_crtc->base, 256);
 	radeon_crtc->crtc_id = index;
 	radeon_crtc->flip_queue = alloc_workqueue("radeon-crtc", WQ_HIGHPRI, 0);
+	if (unlikely(!radeon_crtc->flip_queue)) {
+		kfree(radeon_crtc);
+		return;
+	}
 	rdev->mode_info.crtcs[index] = radeon_crtc;
 
 	if (rdev->family >= CHIP_BONAIRE) {
-- 
1.9.1


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

* Re: [PATCH] drm/radeon: fix a potential NULL pointer dereference
  2019-09-18 16:31 [PATCH] drm/radeon: fix a potential NULL pointer dereference Allen Pais
@ 2019-09-19 17:11   ` Michel Dänzer
  0 siblings, 0 replies; 3+ messages in thread
From: Michel Dänzer @ 2019-09-19 17:11 UTC (permalink / raw)
  To: Allen Pais; +Cc: dri-devel, airlied, linux-kernel, amd-gfx

On 2019-09-18 6:31 p.m., Allen Pais wrote:
> alloc_workqueue is not checked for errors and as a result,
> a potential NULL dereference could occur.
> 
> Signed-off-by: Allen Pais <allen.pais@oracle.com>
> ---
>  drivers/gpu/drm/radeon/radeon_display.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
> index bd52f15..1a41764 100644
> --- a/drivers/gpu/drm/radeon/radeon_display.c
> +++ b/drivers/gpu/drm/radeon/radeon_display.c
> @@ -683,6 +683,10 @@ static void radeon_crtc_init(struct drm_device *dev, int index)
>  	drm_mode_crtc_set_gamma_size(&radeon_crtc->base, 256);
>  	radeon_crtc->crtc_id = index;
>  	radeon_crtc->flip_queue = alloc_workqueue("radeon-crtc", WQ_HIGHPRI, 0);
> +	if (unlikely(!radeon_crtc->flip_queue)) {
> +		kfree(radeon_crtc);
> +		return;
> +	}
>  	rdev->mode_info.crtcs[index] = radeon_crtc;
>  
>  	if (rdev->family >= CHIP_BONAIRE) {
> 

I'm afraid just silently leaving the CRTC uninitialized isn't a good way
to handle this. The failure would need to be propagated, probably
resulting in the driver aborting its initialization altogether.


-- 
Earthling Michel Dänzer               |               https://redhat.com
Libre software enthusiast             |             Mesa and X developer

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

* Re: [PATCH] drm/radeon: fix a potential NULL pointer dereference
@ 2019-09-19 17:11   ` Michel Dänzer
  0 siblings, 0 replies; 3+ messages in thread
From: Michel Dänzer @ 2019-09-19 17:11 UTC (permalink / raw)
  To: Allen Pais; +Cc: airlied, amd-gfx, linux-kernel, dri-devel

On 2019-09-18 6:31 p.m., Allen Pais wrote:
> alloc_workqueue is not checked for errors and as a result,
> a potential NULL dereference could occur.
> 
> Signed-off-by: Allen Pais <allen.pais@oracle.com>
> ---
>  drivers/gpu/drm/radeon/radeon_display.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
> index bd52f15..1a41764 100644
> --- a/drivers/gpu/drm/radeon/radeon_display.c
> +++ b/drivers/gpu/drm/radeon/radeon_display.c
> @@ -683,6 +683,10 @@ static void radeon_crtc_init(struct drm_device *dev, int index)
>  	drm_mode_crtc_set_gamma_size(&radeon_crtc->base, 256);
>  	radeon_crtc->crtc_id = index;
>  	radeon_crtc->flip_queue = alloc_workqueue("radeon-crtc", WQ_HIGHPRI, 0);
> +	if (unlikely(!radeon_crtc->flip_queue)) {
> +		kfree(radeon_crtc);
> +		return;
> +	}
>  	rdev->mode_info.crtcs[index] = radeon_crtc;
>  
>  	if (rdev->family >= CHIP_BONAIRE) {
> 

I'm afraid just silently leaving the CRTC uninitialized isn't a good way
to handle this. The failure would need to be propagated, probably
resulting in the driver aborting its initialization altogether.


-- 
Earthling Michel Dänzer               |               https://redhat.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

end of thread, other threads:[~2019-09-19 17:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-18 16:31 [PATCH] drm/radeon: fix a potential NULL pointer dereference Allen Pais
2019-09-19 17:11 ` Michel Dänzer
2019-09-19 17:11   ` Michel Dänzer

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.