aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAjay Singh <[email protected]>2018-03-26 17:16:00 +0530
committerGreg Kroah-Hartman <[email protected]>2018-03-28 13:38:47 +0200
commit2dc916f48ca300d0d6f6468b8cfe78d29c4f8423 (patch)
treee06f069a6eae16020089d1b3a7972ca70e9d1220
parent8d5b5e6a26d187221c541a8fb0c59ab8ad536888 (diff)
staging: wilc1000: fix to free allocated memory in wilc_add_ptk()
Free allocated memory in wilc_add_ptk() when it fails to enqueue the command. Signed-off-by: Ajay Singh <[email protected]> Reviewed-by: Claudiu Beznea <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
-rw-r--r--drivers/staging/wilc1000/host_interface.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index da53fec46590..3e1c5d347a4f 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -2793,7 +2793,7 @@ int wilc_add_ptk(struct wilc_vif *vif, const u8 *ptk, u8 ptk_key_len,
const u8 *mac_addr, const u8 *rx_mic, const u8 *tx_mic,
u8 mode, u8 cipher_mode, u8 index)
{
- int result = 0;
+ int result;
struct host_if_msg msg;
struct host_if_drv *hif_drv = vif->hif_drv;
u8 key_len = ptk_key_len;
@@ -2838,13 +2838,14 @@ int wilc_add_ptk(struct wilc_vif *vif, const u8 *ptk, u8 ptk_key_len,
msg.vif = vif;
result = wilc_enqueue_cmd(&msg);
-
- if (result)
+ if (result) {
netdev_err(vif->ndev, "PTK Key\n");
- else
- wait_for_completion(&hif_drv->comp_test_key_block);
+ kfree(msg.body.key_info.attr.wpa.key);
+ return result;
+ }
- return result;
+ wait_for_completion(&hif_drv->comp_test_key_block);
+ return 0;
}
int wilc_add_rx_gtk(struct wilc_vif *vif, const u8 *rx_gtk, u8 gtk_key_len,