Commit 3b5f10db authored by Ajay Singh's avatar Ajay Singh Committed by Greg Kroah-Hartman

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: 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 2dc916f4
...@@ -2853,7 +2853,7 @@ int wilc_add_rx_gtk(struct wilc_vif *vif, const u8 *rx_gtk, u8 gtk_key_len, ...@@ -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, const u8 *rx_mic, const u8 *tx_mic, u8 mode,
u8 cipher_mode) u8 cipher_mode)
{ {
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 = gtk_key_len; 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, ...@@ -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, msg.body.key_info.attr.wpa.key = kmemdup(rx_gtk,
key_len, key_len,
GFP_KERNEL); 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; return -ENOMEM;
}
if (rx_mic) if (rx_mic)
memcpy(msg.body.key_info.attr.wpa.key + 16, 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, ...@@ -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; msg.body.key_info.attr.wpa.seq_len = key_rsc_len;
result = wilc_enqueue_cmd(&msg); result = wilc_enqueue_cmd(&msg);
if (result) if (result) {
netdev_err(vif->ndev, "RX GTK\n"); netdev_err(vif->ndev, "RX GTK\n");
else kfree(msg.body.key_info.attr.wpa.seq);
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_set_pmkid_info(struct wilc_vif *vif, int wilc_set_pmkid_info(struct wilc_vif *vif,
......
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