iris: return failure if iris_resource_configure_main fail
authorShuicheng Lin <shuicheng.lin@intel.com>
Tue, 19 Jul 2022 08:23:59 +0000 (08:23 +0000)
committerMarge Bot <emma+marge@anholt.net>
Wed, 10 Aug 2022 16:59:32 +0000 (16:59 +0000)
commitfdab8fef7aff0270ec173cbdca33d434a43ac8ab
tree2264a79faec3523620a2067851f5b21ee9d54e89
parent001779a33d80861d4bdabc3d0c7c78f75dee113f
iris: return failure if iris_resource_configure_main fail

For surface created by eglCreatePbufferSurface with attrib_list is NULL
or empty, the width/height info is 0. Then in the next eglMakeCurrent
call, it will try to allocate the buffer with the 0 width/height, then
call surf_fill_state_s with 0 width/height, so the isl_extent3d returned
by isl_get_image_alignment is (0, 0, 0), and the unreachable code will
cause process crash with:
"stack corruption detected (-fstack-protector)".

As the width is 0, it causes row_pitch_B is 0 in isl_calc_row_pitch.
And it leads to iris_resource_configure_main return fail. Update code
to return fail to avoid the crash.

Signed-off-by: Shuicheng Lin <shuicheng.lin@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17621>
src/gallium/drivers/iris/iris_resource.c