From b5d0b97c2ee0c882c4ccbfc16b9b6c0683e39081 Mon Sep 17 00:00:00 2001 From: Bapiraju Alla Date: Mon, 22 Feb 2021 13:18:58 +0530 Subject: [PATCH] qcacld-3.0: Protect set_thermal_mitigation with dsc psoc sync Currently, the operation set thermal mitigation which is invoked from PLD is not dsc protected. As a result it is causing a memory leak issue when there is an idle shutdown is happening in parallel. To avoid this, protect set thermal mitigation operation with dsc psoc sync. Change-Id: Id36086dd7668258f0aa1d57bc30948e14510e4de CRs-Fixed: 2882729 --- core/hdd/src/wlan_hdd_thermal.c | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/core/hdd/src/wlan_hdd_thermal.c b/core/hdd/src/wlan_hdd_thermal.c index 030c1c3be676..950eeb911cc2 100644 --- a/core/hdd/src/wlan_hdd_thermal.c +++ b/core/hdd/src/wlan_hdd_thermal.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 The Linux Foundation. All rights reserved. + * Copyright (c) 2020-2021 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -278,15 +278,14 @@ QDF_STATUS hdd_restore_thermal_mitigation_config(struct hdd_context *hdd_ctx) return status; } -int wlan_hdd_pld_set_thermal_mitigation(struct device *dev, unsigned long state, - int mon_id) +static int +__wlan_hdd_pld_set_thermal_mitigation(struct device *dev, unsigned long state, + int mon_id) { struct hdd_context *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD); QDF_STATUS status; int ret; - hdd_enter(); - ret = wlan_hdd_validate_context(hdd_ctx); if (ret) return ret; @@ -296,10 +295,29 @@ int wlan_hdd_pld_set_thermal_mitigation(struct device *dev, unsigned long state, status = hdd_send_thermal_mitigation_val(hdd_ctx, state, mon_id); - hdd_exit(); return qdf_status_to_os_return(status); } +int wlan_hdd_pld_set_thermal_mitigation(struct device *dev, unsigned long state, + int mon_id) +{ + struct osif_psoc_sync *psoc_sync; + int ret; + + hdd_enter(); + + ret = osif_psoc_sync_op_start(dev, &psoc_sync); + if (ret) + return ret; + + ret = __wlan_hdd_pld_set_thermal_mitigation(dev, state, mon_id); + + osif_psoc_sync_op_stop(psoc_sync); + hdd_exit(); + + return ret; +} + #ifdef FEATURE_WPSS_THERMAL_MITIGATION inline void hdd_thermal_mitigation_register_wpps(struct hdd_context *hdd_ctx, struct device *dev)