From cec1546fce08cc8ca5aa9b69aec02bd17dcece04 Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Tue, 20 Dec 2016 10:37:07 -0600 Subject: [PATCH] netdev: Fix crash on netdev_disconnect --- src/netdev.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/netdev.c b/src/netdev.c index 97274dcb..ea2d7c47 100644 --- a/src/netdev.c +++ b/src/netdev.c @@ -1463,6 +1463,10 @@ int netdev_disconnect(struct netdev *netdev, if (netdev->disconnect_cmd_id) return -EINPROGRESS; + /* Build deauthenticate prior to handshake_state being cleared */ + deauthenticate = netdev_build_cmd_deauthenticate(netdev, + MPDU_REASON_CODE_DEAUTH_LEAVING); + /* Only perform this if we haven't successfully fully associated yet */ if (!netdev->operational) { netdev->result = NETDEV_RESULT_ABORTED; @@ -1471,8 +1475,6 @@ int netdev_disconnect(struct netdev *netdev, netdev_connect_free(netdev); } - deauthenticate = netdev_build_cmd_deauthenticate(netdev, - MPDU_REASON_CODE_DEAUTH_LEAVING); netdev->disconnect_cmd_id = l_genl_family_send(nl80211, deauthenticate, netdev_cmd_deauthenticate_cb, netdev, NULL);