gallium/u_threaded_context: fix use-after-free in transfer_unmap

discovered by valgrind

Fixes: fd6a5e112a

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6952>
(cherry picked from commit 3dc00c33f0)
This commit is contained in:
Marek Olšák 2020-10-05 12:02:19 -04:00 committed by Dylan Baker
parent 332c00a536
commit 72c3e51c39
2 changed files with 2 additions and 2 deletions

View file

@ -2308,7 +2308,7 @@
"description": "gallium/u_threaded_context: fix use-after-free in transfer_unmap",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"master_sha": null,
"because_sha": "fd6a5e112aa1fd09bc01f4cf3ca211ad73cc404e"
},

View file

@ -1608,9 +1608,9 @@ tc_transfer_unmap(struct pipe_context *_pipe, struct pipe_transfer *transfer)
PIPE_TRANSFER_DISCARD_RANGE)));
struct pipe_context *pipe = tc->pipe;
pipe->transfer_unmap(pipe, transfer);
util_range_add(&tres->b, tres->base_valid_buffer_range,
transfer->box.x, transfer->box.x + transfer->box.width);
pipe->transfer_unmap(pipe, transfer);
return;
}