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

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