Patch "drm/amd/pm/smu7: fix a memleak in smu7_hwmgr_backend_init" has been added to the 6.7-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    drm/amd/pm/smu7: fix a memleak in smu7_hwmgr_backend_init

to the 6.7-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     drm-amd-pm-smu7-fix-a-memleak-in-smu7_hwmgr_backend_.patch
and it can be found in the queue-6.7 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit c1e8c9bd09849d9ad08fbff7527c595fba9f4eaa
Author: Zhipeng Lu <alexious@xxxxxxxxxx>
Date:   Sun Dec 24 16:22:47 2023 +0800

    drm/amd/pm/smu7: fix a memleak in smu7_hwmgr_backend_init
    
    [ Upstream commit 2f3be3ca779b11c332441b10e00443a2510f4d7b ]
    
    The hwmgr->backend, (i.e. data) allocated by kzalloc is not freed in
    the error-handling paths of smu7_get_evv_voltages and
    smu7_update_edc_leakage_table. However, it did be freed in the
    error-handling of phm_initializa_dynamic_state_adjustment_rule_settings,
    by smu7_hwmgr_backend_fini. So the lack of free in smu7_get_evv_voltages
    and smu7_update_edc_leakage_table is considered a memleak in this patch.
    
    Fixes: 599a7e9fe1b6 ("drm/amd/powerplay: implement smu7 hwmgr to manager asics with smu ip version 7.")
    Fixes: 8f0804c6b7d0 ("drm/amd/pm: add edc leakage controller setting")
    Signed-off-by: Zhipeng Lu <alexious@xxxxxxxxxx>
    Signed-off-by: Alex Deucher <alexander.deucher@xxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c
index 11372fcc59c8..b1a8799e2dee 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c
+++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c
@@ -2974,6 +2974,8 @@ static int smu7_hwmgr_backend_init(struct pp_hwmgr *hwmgr)
 		result = smu7_get_evv_voltages(hwmgr);
 		if (result) {
 			pr_info("Get EVV Voltage Failed.  Abort Driver loading!\n");
+			kfree(hwmgr->backend);
+			hwmgr->backend = NULL;
 			return -EINVAL;
 		}
 	} else {
@@ -3019,8 +3021,10 @@ static int smu7_hwmgr_backend_init(struct pp_hwmgr *hwmgr)
 	}
 
 	result = smu7_update_edc_leakage_table(hwmgr);
-	if (result)
+	if (result) {
+		smu7_hwmgr_backend_fini(hwmgr);
 		return result;
+	}
 
 	return 0;
 }




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux