diff options
author | Ajay Singh | 2018-03-26 13:46:01 +0200 |
---|---|---|
committer | Greg Kroah-Hartman | 2018-03-28 13:38:47 +0200 |
commit | 3b5f10dbea184d2201207e78eb548c267c0474e2 (patch) | |
tree | 9fc6d60464acf54cc5c6531e324f5c8e5c6a2d4d /drivers/staging/wilc1000/host_interface.c | |
parent | staging: wilc1000: fix to free allocated memory in wilc_add_ptk() (diff) | |
download | kernel-qcow2-linux-3b5f10dbea184d2201207e78eb548c267c0474e2.tar.gz kernel-qcow2-linux-3b5f10dbea184d2201207e78eb548c267c0474e2.tar.xz kernel-qcow2-linux-3b5f10dbea184d2201207e78eb548c267c0474e2.zip |
staging: wilc1000: free allocated memory in wilc_add_rx_gtk()
Free memory allocated in wilc_add_rx_gtk() before returing from the
function.
Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/wilc1000/host_interface.c')
-rw-r--r-- | drivers/staging/wilc1000/host_interface.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 3e1c5d347a4f..b82110b04693 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -2853,7 +2853,7 @@ int wilc_add_rx_gtk(struct wilc_vif *vif, const u8 *rx_gtk, u8 gtk_key_len, const u8 *rx_mic, const u8 *tx_mic, u8 mode, u8 cipher_mode) { - int result = 0; + int result; struct host_if_msg msg; struct host_if_drv *hif_drv = vif->hif_drv; u8 key_len = gtk_key_len; @@ -2892,8 +2892,10 @@ int wilc_add_rx_gtk(struct wilc_vif *vif, const u8 *rx_gtk, u8 gtk_key_len, msg.body.key_info.attr.wpa.key = kmemdup(rx_gtk, key_len, GFP_KERNEL); - if (!msg.body.key_info.attr.wpa.key) + if (!msg.body.key_info.attr.wpa.key) { + kfree(msg.body.key_info.attr.wpa.seq); return -ENOMEM; + } if (rx_mic) memcpy(msg.body.key_info.attr.wpa.key + 16, rx_mic, @@ -2908,12 +2910,15 @@ int wilc_add_rx_gtk(struct wilc_vif *vif, const u8 *rx_gtk, u8 gtk_key_len, msg.body.key_info.attr.wpa.seq_len = key_rsc_len; result = wilc_enqueue_cmd(&msg); - if (result) + if (result) { netdev_err(vif->ndev, "RX GTK\n"); - else - wait_for_completion(&hif_drv->comp_test_key_block); + kfree(msg.body.key_info.attr.wpa.seq); + 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_set_pmkid_info(struct wilc_vif *vif, |