[PATCH] PASN: Free extra_ies in pasn_data_deinit()
Andrei Otcheretianski
andrei.otcheretianski at intel.com
Thu Nov 26 04:45:48 PST 2026
From: Ilan Peer <ilan.peer at intel.com>
The extra_ies buffer has been owned by struct pasn_data since commit
147f83692475 ("PASN: Add set and get API for PASN data context"):
pasn_set_extra_ies() stores its own copy and wpa_pasn_reset() frees
it. pasn_data_deinit() does not free it, though, unlike the other
buffers it owns. This works only because all the current users call
wpa_pasn_reset() before pasn_data_deinit().
Free extra_ies in pasn_data_deinit() as well. While at it, drop the
const qualifier from the field. It is left over from the time the
field pointed to a buffer owned by the caller, and only forced casts
when freeing it.
Signed-off-by: Ilan Peer <ilan.peer at intel.com>
Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski at intel.com>
---
src/pasn/pasn_common.c | 3 ++-
src/pasn/pasn_common.h | 2 +-
src/pasn/pasn_initiator.c | 2 +-
3 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/pasn/pasn_common.c b/src/pasn/pasn_common.c
index 32278e4d52..86e4dd7d64 100644
--- a/src/pasn/pasn_common.c
+++ b/src/pasn/pasn_common.c
@@ -39,6 +39,7 @@ void pasn_data_deinit(struct pasn_data *pasn)
wpabuf_free(pasn->auth1);
os_free(pasn->dec_pw_id);
wpabuf_free(pasn->security_profile);
+ os_free(pasn->extra_ies);
bin_clear_free(pasn, sizeof(struct pasn_data));
}
@@ -219,7 +220,7 @@ int pasn_set_extra_ies(struct pasn_data *pasn, const u8 *extra_ies,
return -1;
if (pasn->extra_ies) {
- os_free((u8 *) pasn->extra_ies);
+ os_free(pasn->extra_ies);
pasn->extra_ies_len = 0;
}
diff --git a/src/pasn/pasn_common.h b/src/pasn/pasn_common.h
index ad7f6f2923..16007a3b86 100644
--- a/src/pasn/pasn_common.h
+++ b/src/pasn/pasn_common.h
@@ -85,7 +85,7 @@ struct pasn_data {
* Extra elements to add into Authentication frames. These can be used,
* e.g., for Wi-Fi Aware use cases.
*/
- const u8 *extra_ies;
+ u8 *extra_ies;
size_t extra_ies_len;
/* Security Profile element to include in PASN Auth frame 1 only. */
diff --git a/src/pasn/pasn_initiator.c b/src/pasn/pasn_initiator.c
index 3409ea1a30..bbac5f78aa 100644
--- a/src/pasn/pasn_initiator.c
+++ b/src/pasn/pasn_initiator.c
@@ -966,7 +966,7 @@ void wpa_pasn_reset(struct pasn_data *pasn)
pasn->custom_pmkid_valid = false;
if (pasn->extra_ies) {
- os_free((u8 *) pasn->extra_ies);
+ os_free(pasn->extra_ies);
pasn->extra_ies = NULL;
}
--
2.56.1
More information about the Hostap
mailing list