Mesa (staging/19.3): radv: fix double free corruption in radv_alloc_memory()

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jan 23 22:40:48 UTC 2020


Module: Mesa
Branch: staging/19.3
Commit: c983251aa1de6eb44ef3ed2543879f85f921ec80
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=c983251aa1de6eb44ef3ed2543879f85f921ec80

Author: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Date:   Wed Jan 22 08:40:11 2020 +0100

radv: fix double free corruption in radv_alloc_memory()

If the driver fails to allocate memory for some reasons, it shouldn't
free the 'mem' object twice.

Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/2302
Fixes: 825ddfee599 ("radv: Handle device memory alloc failure with normal free.")
Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3508>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3508>
(cherry picked from commit bd51538d285ad0ef488df60e24eaa08b9da20c28)

---

 .pick_status.json            | 2 +-
 src/amd/vulkan/radv_device.c | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index ca319e16abf..a410980d744 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -4,7 +4,7 @@
         "description": "radv: fix double free corruption in radv_alloc_memory()",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": "825ddfee59945e00845637262fba05975f7d16a4"
     },
diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index 2db0cc9ac96..8a0f8f4c249 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -4736,7 +4736,6 @@ static VkResult radv_alloc_memory(struct radv_device *device,
 
 fail:
 	radv_free_memory(device, pAllocator,mem);
-	vk_free2(&device->alloc, pAllocator, mem);
 
 	return result;
 }



More information about the mesa-commit mailing list