summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Kazior <michal.kazior@tieto.com>2013-10-04 08:13:20 +0200
committerKalle Valo <kvalo@qca.qualcomm.com>2013-10-08 15:13:53 +0300
commit9bab1cc010bf07aed12e3f738528c2f05b53db55 (patch)
treed4c4b6dbfe707b18ad72c962ace265abb098f73f
parentfd9c4864a749ba1079fd73bf8394bc15d5c2c892 (diff)
ath10k: fix possible memory leak in new FW loading
Some failpaths did `return` instead of a `goto` leaking requested firmware. Signed-off-by: Michal Kazior <michal.kazior@tieto.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
-rw-r--r--drivers/net/wireless/ath/ath10k/core.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c
index bf85d34e51c4..5acb4048b008 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -404,12 +404,14 @@ static int ath10k_core_fetch_firmware_api_n(struct ath10k *ar, const char *name)
if (len < magic_len) {
ath10k_err("firmware image too small to contain magic: %zu\n",
len);
- return -EINVAL;
+ ret = -EINVAL;
+ goto err;
}
if (memcmp(data, ATH10K_FIRMWARE_MAGIC, magic_len) != 0) {
ath10k_err("Invalid firmware magic\n");
- return -EINVAL;
+ ret = -EINVAL;
+ goto err;
}
/* jump over the padding */
@@ -431,7 +433,8 @@ static int ath10k_core_fetch_firmware_api_n(struct ath10k *ar, const char *name)
if (len < ie_len) {
ath10k_err("Invalid length for FW IE %d (%zu < %zu)\n",
ie_id, len, ie_len);
- return -EINVAL;
+ ret = -EINVAL;
+ goto err;
}
switch (ie_id) {