From e7219cbcc5372e7718ac82f1e2282d6d04d37e98 Mon Sep 17 00:00:00 2001 From: James Prestwood Date: Mon, 22 Apr 2019 13:17:43 -0700 Subject: [PATCH] netdev: free SAE SM once protocol has completed SAE was behaving inconsitently with respect to freeing the state. It was freeing the SM internally on failure, but requiring netdev free it on success. This removes the call to sae_sm_free in sae.c upon failure, and instead netdev frees the SM in the complete callback in all cases regardless of success or failure. --- src/netdev.c | 4 +++- src/sae.c | 2 -- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/netdev.c b/src/netdev.c index b389c920..f0e6d828 100644 --- a/src/netdev.c +++ b/src/netdev.c @@ -2577,10 +2577,12 @@ static void netdev_sae_complete(uint16_t status, void *user_data) struct iovec iov[3]; int iov_elems = 0; + sae_sm_free(netdev->sae_sm); + netdev->sae_sm = NULL; + if (status != 0) { l_error("SAE exchange failed on %u result %u", netdev->index, status); - netdev->sae_sm = NULL; goto auth_failed; } diff --git a/src/sae.c b/src/sae.c index 446c7c62..49089adf 100644 --- a/src/sae.c +++ b/src/sae.c @@ -157,8 +157,6 @@ static bool sae_cn(const uint8_t *kck, uint16_t send_confirm, static void sae_authentication_failed(struct sae_sm *sm, uint16_t reason) { sm->complete(reason, sm->user_data); - - sae_sm_free(sm); } static void sae_reject_authentication(struct sae_sm *sm, uint16_t reason)