From 5e56f90a68d1d6520bb61b2fb97d6b1b22adbe5c Mon Sep 17 00:00:00 2001 From: Dustin Brown Date: Tue, 28 Aug 2018 15:03:59 -0700 Subject: [PATCH] qcacld-3.0: Free llstats buffer if get fails __wlan_hdd_open_ll_stats_debugfs() fails to free the llstats buffer in the event that wlan_hdd_ll_stats_get() fails. Add error handling for this call which frees the newly allocated buffer. Change-Id: Ic5cff77a758ff81da82dd1143d77da68d87b9291 CRs-Fixed: 2304715 --- core/hdd/src/wlan_hdd_debugfs_llstat.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/core/hdd/src/wlan_hdd_debugfs_llstat.c b/core/hdd/src/wlan_hdd_debugfs_llstat.c index b21fe3dc46eb..7db85b6026d1 100644 --- a/core/hdd/src/wlan_hdd_debugfs_llstat.c +++ b/core/hdd/src/wlan_hdd_debugfs_llstat.c @@ -436,29 +436,36 @@ static int __wlan_hdd_open_ll_stats_debugfs(struct inode *inode, file->private_data = inode->i_private; adapter = (struct hdd_adapter *)file->private_data; - if ((NULL == adapter) || (WLAN_HDD_ADAPTER_MAGIC != adapter->magic)) { + if (!adapter || WLAN_HDD_ADAPTER_MAGIC != adapter->magic) { hdd_err("Invalid adapter or adapter has invalid magic"); return -EINVAL; } hdd_ctx = WLAN_HDD_GET_CTX(adapter); ret = wlan_hdd_validate_context(hdd_ctx); - if (0 != ret) + if (ret) return ret; ret = wlan_hdd_llstats_alloc_buf(); - if (0 != ret) + if (ret) return ret; ret = wlan_hdd_ll_stats_get(adapter, DEBUGFS_LLSTATS_REQID, DEBUGFS_LLSTATS_REQMASK); - if (0 != ret) - return ret; + if (ret) + goto free_buf; hdd_exit(); - return 0; -} + return 0; + +free_buf: + wlan_hdd_llstats_free_buf(); + + hdd_exit(); + + return ret; +} /** * wlan_hdd_open_ll_stats_debugfs() - SSR wrapper function to save private