glx/drisw: return false if shmid == -1
authorDave Airlie <airlied@redhat.com>
Mon, 24 Feb 2020 00:19:51 +0000 (10:19 +1000)
committerMarge Bot <eric+marge@anholt.net>
Tue, 25 Feb 2020 01:23:01 +0000 (01:23 +0000)
If an attempt to create an shm pixmap in XCreateDrawable fails
then it ends up with the shmid == -1. This means the get image
path needs to fallback so return false in this case to use the
non-shm get image path.

Fixes: 02c3dad0f3b4 ("Call shmget() with permission 0600 instead of 0777")
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3823>

src/glx/drisw_glx.c

index 6e37f0274b04e0f2be84fc2ef715ce6f635fff75..dfa3218d759ecf61d4fab2cc970545e77f64cd85 100644 (file)
@@ -303,6 +303,9 @@ swrastGetImageShm2(__DRIdrawable * read,
       if (!XCreateDrawable(prp, shmid, dpy))
          return GL_FALSE;
    }
+
+   if (prp->shminfo.shmid == -1)
+      return GL_FALSE;
    readable = pread->xDrawable;
 
    ximage = prp->ximage;