nvc0: reset TFB bufctx when we no longer hold a reference to the buffers
This fixes some use-after-free situations in dEQP when an xfb state is removed, and then a clear is triggered, which only does a partial validation. It would attempt to read the no-longer-valid buffers, resulting in crashes. Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Cc: "11.1 11.2" <mesa-stable@lists.freedesktop.org>
This commit is contained in:
@@ -309,7 +309,6 @@ nvc0_tfb_validate(struct nvc0_context *nvc0)
|
||||
|
||||
if (!(nvc0->dirty_3d & NVC0_NEW_3D_TFB_TARGETS))
|
||||
return;
|
||||
nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_3D_TFB);
|
||||
|
||||
for (b = 0; b < nvc0->num_tfbbufs; ++b) {
|
||||
struct nvc0_so_target *targ = nvc0_so_target(nvc0->tfbbuf[b]);
|
||||
|
@@ -1184,8 +1184,10 @@ nvc0_set_transform_feedback_targets(struct pipe_context *pipe,
|
||||
}
|
||||
nvc0->num_tfbbufs = num_targets;
|
||||
|
||||
if (nvc0->tfbbuf_dirty)
|
||||
if (nvc0->tfbbuf_dirty) {
|
||||
nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_3D_TFB);
|
||||
nvc0->dirty_3d |= NVC0_NEW_3D_TFB_TARGETS;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
Reference in New Issue
Block a user