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

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