012-FT-Do-not-allow-multiple-Reassociation-Response-fram.patch 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. From: Jouni Malinen <j@w1.fi>
  2. Date: Fri, 22 Sep 2017 12:06:37 +0300
  3. Subject: [PATCH] FT: Do not allow multiple Reassociation Response frames
  4. The driver is expected to not report a second association event without
  5. the station having explicitly request a new association. As such, this
  6. case should not be reachable. However, since reconfiguring the same
  7. pairwise or group keys to the driver could result in nonce reuse issues,
  8. be extra careful here and do an additional state check to avoid this
  9. even if the local driver ends up somehow accepting an unexpected
  10. Reassociation Response frame.
  11. Signed-off-by: Jouni Malinen <j@w1.fi>
  12. ---
  13. --- a/src/rsn_supp/wpa.c
  14. +++ b/src/rsn_supp/wpa.c
  15. @@ -2568,6 +2568,9 @@ void wpa_sm_notify_assoc(struct wpa_sm *
  16. #ifdef CONFIG_TDLS
  17. wpa_tdls_assoc(sm);
  18. #endif /* CONFIG_TDLS */
  19. +#ifdef CONFIG_IEEE80211R
  20. + sm->ft_reassoc_completed = 0;
  21. +#endif /* CONFIG_IEEE80211R */
  22. #ifdef CONFIG_P2P
  23. os_memset(sm->p2p_ip_addr, 0, sizeof(sm->p2p_ip_addr));
  24. --- a/src/rsn_supp/wpa_ft.c
  25. +++ b/src/rsn_supp/wpa_ft.c
  26. @@ -153,6 +153,7 @@ static u8 * wpa_ft_gen_req_ies(struct wp
  27. u16 capab;
  28. sm->ft_completed = 0;
  29. + sm->ft_reassoc_completed = 0;
  30. buf_len = 2 + sizeof(struct rsn_mdie) + 2 + sizeof(struct rsn_ftie) +
  31. 2 + sm->r0kh_id_len + ric_ies_len + 100;
  32. @@ -681,6 +682,11 @@ int wpa_ft_validate_reassoc_resp(struct
  33. return -1;
  34. }
  35. + if (sm->ft_reassoc_completed) {
  36. + wpa_printf(MSG_DEBUG, "FT: Reassociation has already been completed for this FT protocol instance - ignore unexpected retransmission");
  37. + return 0;
  38. + }
  39. +
  40. if (wpa_ft_parse_ies(ies, ies_len, &parse) < 0) {
  41. wpa_printf(MSG_DEBUG, "FT: Failed to parse IEs");
  42. return -1;
  43. @@ -781,6 +787,8 @@ int wpa_ft_validate_reassoc_resp(struct
  44. return -1;
  45. }
  46. + sm->ft_reassoc_completed = 1;
  47. +
  48. if (wpa_ft_process_gtk_subelem(sm, parse.gtk, parse.gtk_len) < 0)
  49. return -1;
  50. --- a/src/rsn_supp/wpa_i.h
  51. +++ b/src/rsn_supp/wpa_i.h
  52. @@ -128,6 +128,7 @@ struct wpa_sm {
  53. size_t r0kh_id_len;
  54. u8 r1kh_id[FT_R1KH_ID_LEN];
  55. int ft_completed;
  56. + int ft_reassoc_completed;
  57. int over_the_ds_in_progress;
  58. u8 target_ap[ETH_ALEN]; /* over-the-DS target AP */
  59. int set_ptk_after_assoc;