diff options
author | Jason Ekstrand <jason.ekstrand@collabora.com> | 2022-05-20 18:05:10 -0500 |
---|---|---|
committer | Marge Bot <emma+marge@anholt.net> | 2022-08-23 16:41:56 +0000 |
commit | 4f9dabc1a65043f329d4bfdfc751be227619b291 (patch) | |
tree | 01f8c106dacca6a2ebb0eea260e821811e3f2e49 | |
parent | 297d82763b724f0a98977be024000d1c119f1754 (diff) | |
download | mesa-4f9dabc1a65043f329d4bfdfc751be227619b291.tar.gz mesa-4f9dabc1a65043f329d4bfdfc751be227619b291.tar.bz2 mesa-4f9dabc1a65043f329d4bfdfc751be227619b291.zip |
radv/meta: Fix a stack use-after-free with sample locations
As soon as the if ends (or possibly before?) the VkSampleLocationsInfoEXT
goes out of scope. We need it to stay valid until after the
vkCmdPipelineBarrier completes.
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18084>
-rw-r--r-- | src/amd/vulkan/radv_meta_resolve.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/amd/vulkan/radv_meta_resolve.c b/src/amd/vulkan/radv_meta_resolve.c index 0f6d688ced7..907b9d96ded 100644 --- a/src/amd/vulkan/radv_meta_resolve.c +++ b/src/amd/vulkan/radv_meta_resolve.c @@ -822,6 +822,7 @@ radv_decompress_resolve_src(struct radv_cmd_buffer *cmd_buffer, struct radv_imag } }; + VkSampleLocationsInfoEXT sample_loc_info; if (src_image->vk.create_flags & VK_IMAGE_CREATE_SAMPLE_LOCATIONS_COMPATIBLE_DEPTH_BIT_EXT) { /* If the depth/stencil image uses different sample * locations, we need them during HTILE decompressions. @@ -829,13 +830,14 @@ radv_decompress_resolve_src(struct radv_cmd_buffer *cmd_buffer, struct radv_imag struct radv_sample_locations_state *sample_locs = radv_get_resolve_sample_locations(cmd_buffer); - barrier.pNext = &(VkSampleLocationsInfoEXT){ + sample_loc_info = (VkSampleLocationsInfoEXT){ .sType = VK_STRUCTURE_TYPE_SAMPLE_LOCATIONS_INFO_EXT, .sampleLocationsPerPixel = sample_locs->per_pixel, .sampleLocationGridSize = sample_locs->grid_size, .sampleLocationsCount = sample_locs->count, .pSampleLocations = sample_locs->locations, }; + barrier.pNext = &sample_loc_info; } VkDependencyInfo dep_info = { |