staging: wilc1000: handle freeing of key data in wilc_add_ptk()
authorAjay Singh <ajay.kathat@microchip.com>
Tue, 26 Jun 2018 06:07:10 +0000 (11:37 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 28 Jun 2018 12:55:51 +0000 (21:55 +0900)
Handle freeing of memory allocated to store the 'key' in wilc_add_ptk()
function. Once work completion notification is received, free the
memory allocated to avoid missing of free in work function sepecially
for error scenario.

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>
drivers/staging/wilc1000/host_interface.c

index 2cc968953ba0cb43472f852b0361fd15db745513..2062f4e6f3f362b0ab8375a7121847910d0892c1 100644 (file)
@@ -1724,7 +1724,6 @@ out_wpa_rx_gtk:
 
 out_wpa_ptk:
                complete(&msg->work_comp);
-               kfree(hif_key->attr.wpa.key);
                break;
 
        case PMKSA:
@@ -2735,8 +2734,6 @@ int wilc_add_ptk(struct wilc_vif *vif, const u8 *ptk, u8 ptk_key_len,
        }
 
        wait_for_completion(&msg->work_comp);
-       kfree(msg);
-       return 0;
 
 free_key:
        kfree(msg->body.key_info.attr.wpa.key);