Wireless Daemon for Linux
 help / color / mirror / Atom feed
From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.01.org
Subject: [PATCH 2/4] eapol: reorder eapol_sm_free
Date: Wed, 16 Oct 2019 16:43:02 -0700	[thread overview]
Message-ID: <20191016234304.14716-2-prestwoj@gmail.com> (raw)
In-Reply-To: <20191016234304.14716-1-prestwoj@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 763 bytes --]

This was reported by coverity as a use after free. Technically it is
correct, though this will not pose a problem since l_queue_remove will
not actually dereference the pointer. Reordering this should fix the
warning and not change behavior at all.
---
 src/eapol.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/eapol.c b/src/eapol.c
index 6732b370..cbaf0f4f 100644
--- a/src/eapol.c
+++ b/src/eapol.c
@@ -886,9 +886,9 @@ struct eapol_sm *eapol_sm_new(struct handshake_state *hs)
 
 void eapol_sm_free(struct eapol_sm *sm)
 {
-	eapol_sm_destroy(sm);
-
 	l_queue_remove(state_machines, sm);
+
+	eapol_sm_destroy(sm);
 }
 
 void eapol_sm_set_listen_interval(struct eapol_sm *sm, uint16_t interval)
-- 
2.17.1

  reply	other threads:[~2019-10-16 23:43 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-16 23:43 [PATCH 1/4] util: add bounds check to util_get_{domain,username} James Prestwood
2019-10-16 23:43 ` James Prestwood [this message]
2019-10-17  2:18   ` [PATCH 2/4] eapol: reorder eapol_sm_free Denis Kenzior
2019-10-16 23:43 ` [PATCH 3/4] eapol: check return of ie_parse_rsne_from_data James Prestwood
2019-10-17  2:25   ` Denis Kenzior
2019-10-16 23:43 ` [PATCH 4/4] ie: reorder ie_parse_osen to fix uninitialized value James Prestwood
2019-10-17  2:25   ` Denis Kenzior
2019-10-17  2:15 ` [PATCH 1/4] util: add bounds check to util_get_{domain,username} Denis Kenzior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191016234304.14716-2-prestwoj@gmail.com \
    --to=prestwoj@gmail.com \
    --cc=iwd@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox