Mesa (staging/20.3): radv: fix access to uninitialized radeon_bo_metadata

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Dec 14 17:32:27 UTC 2020


Module: Mesa
Branch: staging/20.3
Commit: 7d5c04838673db7c1f59c9e707bf2c09e80e4672
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=7d5c04838673db7c1f59c9e707bf2c09e80e4672

Author: Simon Ser <contact at emersion.fr>
Date:   Thu Dec  3 16:03:15 2020 +0100

radv: fix access to uninitialized radeon_bo_metadata

If the image tiling is set to VK_IMAGE_TILING_LINEAR,
buffer_set_metadata will read an uninitialized radeon_bo_metadata.

Signed-off-by: Simon Ser <contact at emersion.fr>
Fixes: d5fd8cd46eee ("radv: Allow non-dedicated linear images and buffer.")
Cc: mesa-stable
Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7898>
(cherry picked from commit ad19b0714a8d3cb51121b09b6e3915439d5f3452)

---

 .pick_status.json            | 2 +-
 src/amd/vulkan/radv_device.c | 5 ++---
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 0e53180fcce..dd9464e98e6 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -148,7 +148,7 @@
         "description": "radv: fix access to uninitialized radeon_bo_metadata",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": "d5fd8cd46eeedeabf8647c06489a755aea8f0080"
     },
diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index dbe57c42b5b..c606423d7a6 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -5147,9 +5147,8 @@ bool radv_get_memory_fd(struct radv_device *device,
 {
 	struct radeon_bo_metadata metadata;
 
-	if (memory->image) {
-		if (memory->image->tiling != VK_IMAGE_TILING_LINEAR)
-			radv_init_metadata(device, memory->image, &metadata);
+	if (memory->image && memory->image->tiling != VK_IMAGE_TILING_LINEAR) {
+		radv_init_metadata(device, memory->image, &metadata);
 		device->ws->buffer_set_metadata(memory->bo, &metadata);
 	}
 



More information about the mesa-commit mailing list