Commit 2dc916f4 authored by Ajay Singh's avatar Ajay Singh Committed by Greg Kroah-Hartman

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: default avatarAjay Singh <ajay.kathat@microchip.com>
Reviewed-by: default avatarClaudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 8d5b5e6a
...@@ -2793,7 +2793,7 @@ int wilc_add_ptk(struct wilc_vif *vif, const u8 *ptk, u8 ptk_key_len, ...@@ -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, const u8 *mac_addr, const u8 *rx_mic, const u8 *tx_mic,
u8 mode, u8 cipher_mode, u8 index) u8 mode, u8 cipher_mode, u8 index)
{ {
int result = 0; int result;
struct host_if_msg msg; struct host_if_msg msg;
struct host_if_drv *hif_drv = vif->hif_drv; struct host_if_drv *hif_drv = vif->hif_drv;
u8 key_len = ptk_key_len; 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, ...@@ -2838,13 +2838,14 @@ int wilc_add_ptk(struct wilc_vif *vif, const u8 *ptk, u8 ptk_key_len,
msg.vif = vif; msg.vif = vif;
result = wilc_enqueue_cmd(&msg); result = wilc_enqueue_cmd(&msg);
if (result) {
if (result)
netdev_err(vif->ndev, "PTK Key\n"); netdev_err(vif->ndev, "PTK Key\n");
else kfree(msg.body.key_info.attr.wpa.key);
wait_for_completion(&hif_drv->comp_test_key_block); 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, int wilc_add_rx_gtk(struct wilc_vif *vif, const u8 *rx_gtk, u8 gtk_key_len,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment