Always reset the vertex bufctx to make sure there's no pointer to
an already freed pipe_resource left after unbinding buffers.
Fixes use after free crash in nvc0_bufctx_fence().
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93004
Signed-off-by: Patrick Rudolph <siro@das-labor.org>
[imirkin: simplify nvc0 fix, apply to nv50]
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "11.0 11.1" <mesa-stable@lists.freedesktop.org>
struct nv50_context *nv50 = nv50_context(pipe);
unsigned i;
+ nouveau_bufctx_reset(nv50->bufctx_3d, NV50_BIND_VERTEX);
+ nv50->dirty |= NV50_NEW_ARRAYS;
+
util_set_vertex_buffers_count(nv50->vtxbuf, &nv50->num_vtxbufs, vb,
start_slot, count);
nv50->vbo_constant &= ~(1 << dst_index);
}
}
-
- nouveau_bufctx_reset(nv50->bufctx_3d, NV50_BIND_VERTEX);
-
- nv50->dirty |= NV50_NEW_ARRAYS;
}
static void
struct nvc0_context *nvc0 = nvc0_context(pipe);
unsigned i;
+ nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_VTX);
+ nvc0->dirty |= NVC0_NEW_ARRAYS;
+
util_set_vertex_buffers_count(nvc0->vtxbuf, &nvc0->num_vtxbufs, vb,
start_slot, count);
nvc0->constant_vbos &= ~(1 << dst_index);
}
}
-
- nvc0->dirty |= NVC0_NEW_ARRAYS;
- nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_VTX);
}
static void