Blame SOURCES/rh1495527-0008-FT-Do-not-allow-multiple-Reassociation-Response-fram.patch

9c84ec
From b372ab0b7daea719749194dc554b26e6367603f2 Mon Sep 17 00:00:00 2001
9c84ec
From: Jouni Malinen <j@w1.fi>
9c84ec
Date: Fri, 22 Sep 2017 12:06:37 +0300
9c84ec
Subject: [PATCH 8/8] FT: Do not allow multiple Reassociation Response frames
9c84ec
9c84ec
The driver is expected to not report a second association event without
9c84ec
the station having explicitly request a new association. As such, this
9c84ec
case should not be reachable. However, since reconfiguring the same
9c84ec
pairwise or group keys to the driver could result in nonce reuse issues,
9c84ec
be extra careful here and do an additional state check to avoid this
9c84ec
even if the local driver ends up somehow accepting an unexpected
9c84ec
Reassociation Response frame.
9c84ec
9c84ec
Signed-off-by: Jouni Malinen <j@w1.fi>
9c84ec
---
9c84ec
 src/rsn_supp/wpa.c    | 3 +++
9c84ec
 src/rsn_supp/wpa_ft.c | 8 ++++++++
9c84ec
 src/rsn_supp/wpa_i.h  | 1 +
9c84ec
 3 files changed, 12 insertions(+)
9c84ec
9c84ec
diff --git a/src/rsn_supp/wpa.c b/src/rsn_supp/wpa.c
9c84ec
index 0550a41..2a53c6f 100644
9c84ec
--- a/src/rsn_supp/wpa.c
9c84ec
+++ b/src/rsn_supp/wpa.c
9c84ec
@@ -2440,6 +2440,9 @@ void wpa_sm_notify_disassoc(struct wpa_sm *sm)
9c84ec
 #ifdef CONFIG_TDLS
9c84ec
 	wpa_tdls_disassoc(sm);
9c84ec
 #endif /* CONFIG_TDLS */
9c84ec
+#ifdef CONFIG_IEEE80211R
9c84ec
+	sm->ft_reassoc_completed = 0;
9c84ec
+#endif /* CONFIG_IEEE80211R */
9c84ec
 
9c84ec
 	/* Keys are not needed in the WPA state machine anymore */
9c84ec
 	wpa_sm_drop_sa(sm);
9c84ec
diff --git a/src/rsn_supp/wpa_ft.c b/src/rsn_supp/wpa_ft.c
9c84ec
index 205793e..d45bb45 100644
9c84ec
--- a/src/rsn_supp/wpa_ft.c
9c84ec
+++ b/src/rsn_supp/wpa_ft.c
9c84ec
@@ -153,6 +153,7 @@ static u8 * wpa_ft_gen_req_ies(struct wpa_sm *sm, size_t *len,
9c84ec
 	u16 capab;
9c84ec
 
9c84ec
 	sm->ft_completed = 0;
9c84ec
+	sm->ft_reassoc_completed = 0;
9c84ec
 
9c84ec
 	buf_len = 2 + sizeof(struct rsn_mdie) + 2 + sizeof(struct rsn_ftie) +
9c84ec
 		2 + sm->r0kh_id_len + ric_ies_len + 100;
9c84ec
@@ -681,6 +682,11 @@ int wpa_ft_validate_reassoc_resp(struct wpa_sm *sm, const u8 *ies,
9c84ec
 		return -1;
9c84ec
 	}
9c84ec
 
9c84ec
+	if (sm->ft_reassoc_completed) {
9c84ec
+		wpa_printf(MSG_DEBUG, "FT: Reassociation has already been completed for this FT protocol instance - ignore unexpected retransmission");
9c84ec
+		return 0;
9c84ec
+	}
9c84ec
+
9c84ec
 	if (wpa_ft_parse_ies(ies, ies_len, &parse) < 0) {
9c84ec
 		wpa_printf(MSG_DEBUG, "FT: Failed to parse IEs");
9c84ec
 		return -1;
9c84ec
@@ -781,6 +787,8 @@ int wpa_ft_validate_reassoc_resp(struct wpa_sm *sm, const u8 *ies,
9c84ec
 		return -1;
9c84ec
 	}
9c84ec
 
9c84ec
+	sm->ft_reassoc_completed = 1;
9c84ec
+
9c84ec
 	if (wpa_ft_process_gtk_subelem(sm, parse.gtk, parse.gtk_len) < 0)
9c84ec
 		return -1;
9c84ec
 
9c84ec
diff --git a/src/rsn_supp/wpa_i.h b/src/rsn_supp/wpa_i.h
9c84ec
index 41f371f..56f88dc 100644
9c84ec
--- a/src/rsn_supp/wpa_i.h
9c84ec
+++ b/src/rsn_supp/wpa_i.h
9c84ec
@@ -128,6 +128,7 @@ struct wpa_sm {
9c84ec
 	size_t r0kh_id_len;
9c84ec
 	u8 r1kh_id[FT_R1KH_ID_LEN];
9c84ec
 	int ft_completed;
9c84ec
+	int ft_reassoc_completed;
9c84ec
 	int over_the_ds_in_progress;
9c84ec
 	u8 target_ap[ETH_ALEN]; /* over-the-DS target AP */
9c84ec
 	int set_ptk_after_assoc;
9c84ec
-- 
9c84ec
2.7.4
9c84ec