Skip to contentSkip to conversation

nouveau: Mark nouveau subchannel unbound nouveau_grobj_free

PATCH In review Maarten Lankhorst 2 participants 2 messages Nov 24, 2011 – Nov 27, 2011 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nouveau: Mark nouveau subchannel unbound nouveau_grobj_free

Valgrind throws warns about a user-after-free if you try to bind a new subchannel after the old one in that slot was freed, so remove it from the channel list.

nouveau/nouveau_grobj.c +2 -1
@@ -100,12 +99,13 @@ nouveau_grobj_free(struct nouveau_grobj **grobj)
 		struct drm_nouveau_gpuobj_free f;
 
 		FIRE_RING(&chan->base);
-
 		f.channel = chan->drm.channel;
 		f.handle  = nvgrobj->base.handle;
 		drmCommandWrite(nvdev->fd, DRM_NOUVEAU_GPUOBJ_FREE,
 				&f, sizeof(f));	
 	}
+	if (nvgrobj->base.bound != NOUVEAU_GROBJ_UNBOUND)
+		chan->base.subc[nvgrobj->base.subc].gr = NULL;
 	free(nvgrobj);
 }
#2 lore raw
In reply to a message not in the archive
Quoted 25 lines · Maarten Lankhorst

Valgrind throws warns about a user-after-free if you try to bind a new subchannel after the old one in that slot was freed, so remove it from the channel list.

nouveau/nouveau_grobj.c +2 -1
@@ -100,12 +99,13 @@ nouveau_grobj_free(struct nouveau_grobj **grobj)
                struct drm_nouveau_gpuobj_free f;
 
                FIRE_RING(&chan->base);
-
                f.channel = chan->drm.channel;
                f.handle  = nvgrobj->base.handle;
                drmCommandWrite(nvdev->fd, DRM_NOUVEAU_GPUOBJ_FREE,
                                &f, sizeof(f));
        }
+       if (nvgrobj->base.bound != NOUVEAU_GROBJ_UNBOUND)
+               chan->base.subc[nvgrobj->base.subc].gr = NULL;
        free(nvgrobj);
  }
 
Quoted 5 lines

_______________________________________________
Nouveau mailing list [email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau

Pushed, thanks.