All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH xf86-video-ati 1/2] Bail from dri2_create_buffer2 if we can't get a pixmap
@ 2018-05-18 14:21 Michel Dänzer
       [not found] ` <20180518142140.20582-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Michel Dänzer @ 2018-05-18 14:21 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

From: Michel Dänzer <michel.daenzer@amd.com>

We would store the NULL pointer and continue, which would lead to a
crash down the road.

Bugzilla: https://bugs.freedesktop.org/106293
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
---
 src/radeon_dri2.c | 40 +++++++++++++++++++---------------------
 1 file changed, 19 insertions(+), 21 deletions(-)

diff --git a/src/radeon_dri2.c b/src/radeon_dri2.c
index 9f373589d..3b75f66f3 100644
--- a/src/radeon_dri2.c
+++ b/src/radeon_dri2.c
@@ -233,37 +233,36 @@ radeon_dri2_create_buffer2(ScreenPtr pScreen,
 					  flags | RADEON_CREATE_PIXMAP_DRI2);
     }
 
+    if (!pixmap)
+	return NULL;
+
     buffers = calloc(1, sizeof *buffers);
     if (buffers == NULL)
         goto error;
 
-    if (pixmap) {
-	if (!info->use_glamor) {
-	    info->exa_force_create = TRUE;
-	    exaMoveInPixmap(pixmap);
-	    info->exa_force_create = FALSE;
-	    if (exaGetPixmapDriverPrivate(pixmap) == NULL) {
-		/* this happen if pixmap is non accelerable */
-		goto error;
-	    }
-	} else if (is_glamor_pixmap) {
-	    pixmap = radeon_glamor_set_pixmap_bo(drawable, pixmap);
-	    pixmap->refcnt++;
-	}
-
-	if (!radeon_get_flink_name(pRADEONEnt, pixmap, &buffers->name))
+    if (!info->use_glamor) {
+	info->exa_force_create = TRUE;
+	exaMoveInPixmap(pixmap);
+	info->exa_force_create = FALSE;
+	if (exaGetPixmapDriverPrivate(pixmap) == NULL) {
+	    /* this happen if pixmap is non accelerable */
 	    goto error;
+	}
+    } else if (is_glamor_pixmap) {
+	pixmap = radeon_glamor_set_pixmap_bo(drawable, pixmap);
+	pixmap->refcnt++;
     }
 
+    if (!radeon_get_flink_name(pRADEONEnt, pixmap, &buffers->name))
+	goto error;
+
     privates = calloc(1, sizeof(struct dri2_buffer_priv));
     if (privates == NULL)
         goto error;
 
     buffers->attachment = attachment;
-    if (pixmap) {
-	buffers->pitch = pixmap->devKind;
-	buffers->cpp = cpp;
-    }
+    buffers->pitch = pixmap->devKind;
+    buffers->cpp = cpp;
     buffers->driverPrivate = privates;
     buffers->format = format;
     buffers->flags = 0; /* not tiled */
@@ -275,8 +274,7 @@ radeon_dri2_create_buffer2(ScreenPtr pScreen,
 
 error:
     free(buffers);
-    if (pixmap)
-        (*pScreen->DestroyPixmap)(pixmap);
+    (*pScreen->DestroyPixmap)(pixmap);
     return NULL;
 }
 
-- 
2.17.0

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

* [PATCH xf86-video-ati 2/2] glamor: Bail CreatePixmap on unsupported pixmap depth
       [not found] ` <20180518142140.20582-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
@ 2018-05-18 14:21   ` Michel Dänzer
       [not found]     ` <20180518142140.20582-2-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Michel Dänzer @ 2018-05-18 14:21 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

From: Michel Dänzer <michel.daenzer@amd.com>

Fixes crash in that case.

Bugzilla: https://bugs.freedesktop.org/106293
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
---
 src/radeon_glamor.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/radeon_glamor.c b/src/radeon_glamor.c
index 7c09abba5..10d513ea9 100644
--- a/src/radeon_glamor.c
+++ b/src/radeon_glamor.c
@@ -214,6 +214,9 @@ radeon_glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth,
 	struct radeon_pixmap *priv;
 	PixmapPtr pixmap, new_pixmap = NULL;
 
+	if (!xf86GetPixFormat(scrn, depth))
+		return NULL;
+
 	if (!RADEON_CREATE_PIXMAP_SHARED(usage)) {
 		if (info->shadow_primary) {
 			if (usage != CREATE_PIXMAP_USAGE_BACKING_PIXMAP)
-- 
2.17.0

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

* Re: [PATCH xf86-video-ati 2/2] glamor: Bail CreatePixmap on unsupported pixmap depth
       [not found]     ` <20180518142140.20582-2-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
@ 2018-05-21 19:02       ` Alex Deucher
  0 siblings, 0 replies; 3+ messages in thread
From: Alex Deucher @ 2018-05-21 19:02 UTC (permalink / raw)
  To: Michel Dänzer; +Cc: amd-gfx list

On Fri, May 18, 2018 at 10:21 AM, Michel Dänzer <michel@daenzer.net> wrote:
> From: Michel Dänzer <michel.daenzer@amd.com>
>
> Fixes crash in that case.
>
> Bugzilla: https://bugs.freedesktop.org/106293
> Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>

Series is:
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

> ---
>  src/radeon_glamor.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/src/radeon_glamor.c b/src/radeon_glamor.c
> index 7c09abba5..10d513ea9 100644
> --- a/src/radeon_glamor.c
> +++ b/src/radeon_glamor.c
> @@ -214,6 +214,9 @@ radeon_glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth,
>         struct radeon_pixmap *priv;
>         PixmapPtr pixmap, new_pixmap = NULL;
>
> +       if (!xf86GetPixFormat(scrn, depth))
> +               return NULL;
> +
>         if (!RADEON_CREATE_PIXMAP_SHARED(usage)) {
>                 if (info->shadow_primary) {
>                         if (usage != CREATE_PIXMAP_USAGE_BACKING_PIXMAP)
> --
> 2.17.0
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

end of thread, other threads:[~2018-05-21 19:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-18 14:21 [PATCH xf86-video-ati 1/2] Bail from dri2_create_buffer2 if we can't get a pixmap Michel Dänzer
     [not found] ` <20180518142140.20582-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
2018-05-18 14:21   ` [PATCH xf86-video-ati 2/2] glamor: Bail CreatePixmap on unsupported pixmap depth Michel Dänzer
     [not found]     ` <20180518142140.20582-2-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
2018-05-21 19:02       ` Alex Deucher

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.