[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211115025901.2598-1-bernard@vivo.com>
Date: Sun, 14 Nov 2021 18:58:50 -0800
From: Bernard Zhao <bernard@...o.com>
To: Alex Deucher <alexander.deucher@....com>,
Christian König <christian.koenig@....com>,
"Pan, Xinhui" <Xinhui.Pan@....com>,
David Airlie <airlied@...ux.ie>,
Daniel Vetter <daniel@...ll.ch>,
Hawking Zhang <Hawking.Zhang@....com>,
John Clements <john.clements@....com>,
Jonathan Kim <jonathan.kim@....com>,
Felix Kuehling <felix.kuehling@....com>,
Kevin Wang <kevin1.wang@....com>,
Tian Tao <tiantao6@...ilicon.com>,
Evan Quan <evan.quan@....com>, shaoyunl <shaoyun.liu@....com>,
amd-gfx@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org,
linux-kernel@...r.kernel.org
Cc: Bernard Zhao <bernard@...o.com>
Subject: [PATCH] drm/amd/amdgpu: fix potential memleak
In function amdgpu_get_xgmi_hive, when kobject_init_and_add failed
There is a potential memleak if not call kobject_put.
Signed-off-by: Bernard Zhao <bernard@...o.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c
index 0fad2bf854ae..567df2db23ac 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c
@@ -386,6 +386,7 @@ struct amdgpu_hive_info *amdgpu_get_xgmi_hive(struct amdgpu_device *adev)
"%s", "xgmi_hive_info");
if (ret) {
dev_err(adev->dev, "XGMI: failed initializing kobject for xgmi hive\n");
+ kobject_put(&hive->kobj);
kfree(hive);
hive = NULL;
goto pro_end;
--
2.33.1
Powered by blists - more mailing lists