27.07.2015 02:43, Dave Airlie пишет:
+modesettingEntPtr ms_ent_priv(ScrnInfoPtr scrn)
+{
+    DevUnion     *pPriv;
+    modesettingPtr ms = modesettingPTR(scrn);
+    pPriv = xf86GetEntityPrivate(ms->pEnt->index,
+                                 ms_entity_index);
+    return pPriv->ptr;
+}

@@ -596,19 +626,25 @@ FreeRec(ScrnInfoPtr pScrn)
      pScrn->driverPrivate = NULL;
if (ms->fd > 0) {
+        modesettingEntPtr ms_ent;
          int ret;
- if (ms->pEnt->location.type == BUS_PCI)
-            ret = drmClose(ms->fd);
-        else
+        ms_ent = ms_ent_priv(pScrn);
                                    prefer_shadow);

diff --git a/hw/xfree86/drivers/modesetting/driver.h 
b/hw/xfree86/drivers/modesetting/driver.h
...
#define modesettingPTR(p) ((modesettingPtr)((p)->driverPrivate))

Calling ms_ent_priv() after setting pScrn->driverPrivate to NULL causes a segfault, because modesettingPTR() in ms_ent_priv() returns NULL.
For example, the segfault happens after unplugging a USB card.
_______________________________________________
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to