lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1458600434-5498-1-git-send-email-colin.king@canonical.com>
Date:	Mon, 21 Mar 2016 22:47:14 +0000
From:	Colin King <colin.king@...onical.com>
To:	Alex Deucher <alexander.deucher@....com>,
	Christian König <christian.koenig@....com>,
	David Airlie <airlied@...ux.ie>, Rex Zhu <Rex.Zhu@....com>,
	Tom St Denis <tom.stdenis@....com>,
	Eric Huang <JinHuiEric.Huang@....com>,
	Ken Wang <Qingqing.Wang@....com>,
	yanyang1 <young.yang@....com>, dri-devel@...ts.freedesktop.org
Cc:	linux-kernel@...r.kernel.org
Subject: [PATCH] drm/amd/powerplay: fix memory leak on tdp_table

From: Colin Ian King <colin.king@...onical.com>

tdp_table is being leaked on an error exit return path,
fix this by kfree'ing it.  Also swap comparison around to make the
patch warning free with checkpatch.

Leak found via static analysis with CoverityScan

Signed-off-by: Colin Ian King <colin.king@...onical.com>
---
 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_processpptables.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_processpptables.c b/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_processpptables.c
index 34f4bef..40b7679 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_processpptables.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_processpptables.c
@@ -512,8 +512,10 @@ static int get_cac_tdp_table(
 
 	hwmgr->dyn_state.cac_dtp_table = kzalloc(table_size, GFP_KERNEL);
 
-	if (NULL == hwmgr->dyn_state.cac_dtp_table)
+	if (hwmgr->dyn_state.cac_dtp_table == NULL) {
+		kfree(tdp_table);
 		return -ENOMEM;
+	}
 
 	memset(hwmgr->dyn_state.cac_dtp_table, 0x00, table_size);
 
-- 
2.7.3

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ