diff options
author | Ajay Singh <ajay.kathat@microchip.com> | 2018-03-26 14:45:58 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-03-28 14:38:46 +0300 |
commit | c26bdea4e709f8918c239f16235b4b7208fbc1cb (patch) | |
tree | 1e07ce451ab80f4814852f414afec2fa5d2b54aa /drivers/staging/wilc1000 | |
parent | 7ab3e668aa9c74fe63fd28d47178d27142cc520d (diff) | |
download | linux-c26bdea4e709f8918c239f16235b4b7208fbc1cb.tar.xz |
staging: wilc1000: free memory allocated in add wep key functions
Free memory allocated for wep key when command enqueue is failed.
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')
-rw-r--r-- | drivers/staging/wilc1000/host_interface.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 89972e86c709..b710b6f6866a 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -2716,7 +2716,7 @@ int wilc_set_wep_default_keyid(struct wilc_vif *vif, u8 index) int wilc_add_wep_key_bss_sta(struct wilc_vif *vif, const u8 *key, u8 len, u8 index) { - int result = 0; + int result; struct host_if_msg msg; struct host_if_drv *hif_drv = vif->hif_drv; @@ -2739,17 +2739,20 @@ int wilc_add_wep_key_bss_sta(struct wilc_vif *vif, const u8 *key, u8 len, msg.body.key_info.attr.wep.index = index; result = wilc_enqueue_cmd(&msg); - if (result) + if (result) { netdev_err(vif->ndev, "STA - WEP Key\n"); - wait_for_completion(&hif_drv->comp_test_key_block); + kfree(msg.body.key_info.attr.wep.key); + return result; + } - return result; + wait_for_completion(&hif_drv->comp_test_key_block); + return 0; } int wilc_add_wep_key_bss_ap(struct wilc_vif *vif, const u8 *key, u8 len, u8 index, u8 mode, enum AUTHTYPE auth_type) { - int result = 0; + int result; struct host_if_msg msg; struct host_if_drv *hif_drv = vif->hif_drv; @@ -2774,13 +2777,14 @@ int wilc_add_wep_key_bss_ap(struct wilc_vif *vif, const u8 *key, u8 len, msg.body.key_info.attr.wep.auth_type = auth_type; result = wilc_enqueue_cmd(&msg); - - if (result) + if (result) { netdev_err(vif->ndev, "AP - WEP Key\n"); - else - wait_for_completion(&hif_drv->comp_test_key_block); + kfree(msg.body.key_info.attr.wep.key); + return result; + } - return result; + wait_for_completion(&hif_drv->comp_test_key_block); + return 0; } int wilc_add_ptk(struct wilc_vif *vif, const u8 *ptk, u8 ptk_key_len, |