[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230418065521.453001-1-d.dulov@aladdin.ru>
Date: Mon, 17 Apr 2023 23:55:21 -0700
From: Daniil Dulov <d.dulov@...ddin.ru>
To: Felix Kuehling <Felix.Kuehling@....com>
CC: Daniil Dulov <d.dulov@...ddin.ru>,
Alex Deucher <alexander.deucher@....com>,
Christian König <christian.koenig@....com>,
David Airlie <airlied@...ux.ie>,
Daniel Vetter <daniel@...ll.ch>, Oak Zeng <ozeng@....com>,
<amd-gfx@...ts.freedesktop.org>, <dri-devel@...ts.freedesktop.org>,
<linux-kernel@...r.kernel.org>, <lvc-project@...uxtesting.org>
Subject: [PATCH] drm/amdkfd: Fix potential deallocation of previously deallocated memory.
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@...ddin.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
Powered by blists - more mailing lists