Skip to contentSkip to conversation

netdev: check for connected in FT frame event

PATCH In review James Prestwood 2 participants 3 messages Apr 5, 2022

lore
Share & tools
lore

James Prestwood

author
#0 lore raw

PATCH 1/2 netdev: check for connected in FT frame event

This frame could come unsolicited and cause a NULL dereference if IWD is not connected.

---
 src/netdev.c | 3 +++
 1 file changed, 3 insertions(+)
src/netdev.c +3 -0
index 36d183e7..5ec7fe4a 100644
@@ -4525,6 +4525,9 @@ static void netdev_ft_response_frame_event(const struct mmpdu_header *hdr,
 	size_t ies_len;
 	struct ft_ds_finder finder;
 
+	if (!netdev->connected)
+		return;
+
 	ret = ft_over_ds_parse_action_response(body, body_len, &spa, &aa,
 						&ies, &ies_len);
 	if (ret < 0)
Signature · 1 line
2.34.1
author
#1 lore raw

PATCH 2/2 netdev: move ocvc setting to after connected check

We cannot check 'handshake' until first checking that IWD is connected.

---
 src/netdev.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
src/netdev.c +4 -2
index 5ec7fe4a..e483edf8 100644
@@ -4990,8 +4990,7 @@ static void netdev_sa_query_req_frame_event(const struct mmpdu_header *hdr,
 	uint16_t transaction;
 	const uint8_t *oci;
 	struct netdev *netdev = user_data;
-	bool ocvc = netdev->handshake->supplicant_ocvc &&
-					netdev->handshake->authenticator_ocvc;
+	bool ocvc;
 
 	if (body_len < 4) {
 		l_debug("SA Query request too short");
@@ -5001,6 +5000,9 @@ static void netdev_sa_query_req_frame_event(const struct mmpdu_header *hdr,
 	if (!netdev->connected)
 		return;
 
+	ocvc = netdev->handshake->supplicant_ocvc &&
+					netdev->handshake->authenticator_ocvc;
+
 	/* only care about SA Queries from our connected AP */
 	if (memcmp(hdr->address_2, netdev->handshake->aa, 6))
 		return;
Signature · 1 line
2.34.1
#2 lore raw
In reply to James Prestwood

Hi James,

Quoted 6 lines · James Prestwood

This frame could come unsolicited and cause a NULL dereference if IWD is not connected.

---
  src/netdev.c | 3 +++
  1 file changed, 3 insertions(+)

Both applied, thanks.

Regards,
-Denis