All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdkfd: Fix potential deallocation of previously deallocated memory.
@ 2023-04-18  6:55 ` Daniil Dulov
  0 siblings, 0 replies; 20+ messages in thread
From: Daniil Dulov @ 2023-04-18  6:55 UTC (permalink / raw)
  To: Felix Kuehling
  Cc: lvc-project, David Airlie, Daniil Dulov, linux-kernel, amd-gfx,
	dri-devel, Daniel Vetter, Alex Deucher, Oak Zeng,
	Christian König

Pointer mqd_mem_obj can be deallocated in kfd_gtt_sa_allocate().
The function then returns non-zero value, which causes the second deallocation.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: d1f8f0d17d40 ("drm/amdkfd: Move non-sdma mqd allocation out of init_mqd")
Signed-off-by: Daniil Dulov <d.dulov@aladdin.ru>
---
 drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c
index 3b6f5963180d..bce11c5b07d6 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c
@@ -119,7 +119,8 @@ static struct kfd_mem_obj *allocate_mqd(struct kfd_dev *kfd,
 	}
 
 	if (retval) {
-		kfree(mqd_mem_obj);
+		if (mqd_mem_obj)
+			kfree(mqd_mem_obj);
 		return NULL;
 	}
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2023-05-12  8:49 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-18  6:55 [PATCH] drm/amdkfd: Fix potential deallocation of previously deallocated memory Daniil Dulov
2023-04-18  6:55 ` Daniil Dulov
2023-04-18  6:55 ` Daniil Dulov
2023-04-18  8:47 ` Andi Shyti
2023-04-18  8:47   ` Andi Shyti
2023-04-18 10:07   ` Krzysztof Kozlowski
2023-04-18 10:07     ` Krzysztof Kozlowski
2023-04-18 16:59     ` Andi Shyti
2023-04-18 16:59       ` Andi Shyti
2023-04-18 17:44       ` Andi Shyti
2023-04-18 17:44         ` Andi Shyti
2023-04-18 18:12         ` Daniil Dulov
2023-04-18 18:12           ` Daniil Dulov
2023-05-11 11:23         ` [PATCH v2] " Daniil Dulov
2023-05-11 11:23           ` Daniil Dulov
2023-05-11 11:23           ` Daniil Dulov
2023-05-11 11:28           ` kernel test robot
2023-05-11 21:12           ` Felix Kuehling
2023-05-11 21:12             ` Felix Kuehling
2023-05-11 21:12             ` Felix Kuehling

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.