From 021cecdb56c4f1adc0cdd12b67fae52a00202194 Mon Sep 17 00:00:00 2001 From: Dustin Brown Date: Mon, 11 Dec 2017 13:56:43 -0800 Subject: [PATCH] qcacld-3.0: Move memdump init/deinit to avoid runtime leak The memdump feature allocates memory after the module has started, leading to a false positive memory leak when the module is subsequently stopped. Move memdump init to before the module is started in hdd_wlan_startup, and memdump deinit to after the module is stopped in hdd_wlan_exit. Change-Id: I8df48e55e0f1e90fb4599469ce10f7741fb7a9a0 CRs-Fixed: 2157112 --- core/hdd/src/wlan_hdd_main.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index d646d2121cf0..c95144fcfe8b 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -6187,6 +6187,9 @@ static void hdd_wlan_exit(struct hdd_context *hdd_ctx) hdd_wlan_stop_modules(hdd_ctx, false); + memdump_deinit(); + hdd_driver_memdump_deinit(); + qdf_nbuf_deinit_replenish_timer(); qdf_spinlock_destroy(&hdd_ctx->hdd_adapter_lock); @@ -6244,9 +6247,6 @@ void __hdd_wlan_exit(void) return; } - memdump_deinit(); - hdd_driver_memdump_deinit(); - /* Do all the cleanup before deregistering the driver */ hdd_wlan_exit(hdd_ctx); @@ -10211,10 +10211,13 @@ int hdd_wlan_startup(struct device *dev) hdd_request_manager_init(); hdd_green_ap_init(hdd_ctx); + memdump_init(); + hdd_driver_memdump_init(); + ret = hdd_wlan_start_modules(hdd_ctx, NULL, false); if (ret) { hdd_err("Failed to start modules: %d", ret); - goto err_hdd_free_psoc; + goto err_memdump_deinit; } wlan_hdd_update_wiphy(hdd_ctx); @@ -10280,9 +10283,6 @@ int hdd_wlan_startup(struct device *dev) if (QDF_IS_STATUS_ERROR(status)) goto err_close_adapters; - memdump_init(); - hdd_driver_memdump_init(); - if (hdd_ctx->config->fIsImpsEnabled) hdd_set_idle_ps_config(hdd_ctx, true); else @@ -10317,7 +10317,10 @@ err_wiphy_unregister: err_stop_modules: hdd_wlan_stop_modules(hdd_ctx, false); -err_hdd_free_psoc: +err_memdump_deinit: + hdd_driver_memdump_deinit(); + memdump_deinit(); + hdd_green_ap_deinit(hdd_ctx); hdd_request_manager_deinit(); hdd_exit_netlink_services(hdd_ctx);