st/mesa: Validate the result of pipe_transfer_map in make_texture (v2)
authorJosh Pieper <jjp@pobox.com>
Mon, 10 Sep 2018 02:03:27 +0000 (22:03 -0400)
committerMarek Olšák <marek.olsak@amd.com>
Sat, 15 Sep 2018 01:05:37 +0000 (21:05 -0400)
commit936e0dcd619bc092b9869b4be2e1b20c3631131f
tree9836ba8c1957992b3325f338c57a8b42df62f0ad
parentc79aad30ae1f89dfb392f7cbe0f971939629c520
st/mesa: Validate the result of pipe_transfer_map in make_texture (v2)

When using Freecad, I was getting intermittent segfaults inside of
mesa.  I traced it down to this path in st_cb_drawpixels.c where the
result of pipe_transfer_map wasn't being checked.  In my case, it was
returning NULL because nouveau_bo_new returned ENOENT.  I'm by no
means a mesa developer, but this patch solves the problem for me and
seems reasonable enough.

v2: Marek - also unmap the PBO and release the texture, and call
    the make_texture function sooner for less cleanup

Cc: 18.1 18.2 <mesa-stable@lists.freedesktop.org>
src/mesa/state_tracker/st_cb_drawpixels.c