diff mbox series

[v3,03/46] PR: Guard wpas_pr_usd_elems() against uninitialized PR context

Message ID 20260513100010.1947710-4-kavita.kavita@oss.qualcomm.com
State Accepted
Headers show
Series PR: Add nl80211 support and ranging for Proximity Detection | expand

Commit Message

Kavita Kavita May 13, 2026, 9:59 a.m. UTC
global->pr is initialized only when the driver advertises proximity
ranging support.  Add a NULL check in wpas_pr_usd_elems() to return
NULL when the PR context is not available.

Fixes: a760532f76ef ("PR: USD for Proximity Ranging")
Signed-off-by: Kavita Kavita <kavita.kavita@oss.qualcomm.com>
---
 wpa_supplicant/pr_supplicant.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/wpa_supplicant/pr_supplicant.c b/wpa_supplicant/pr_supplicant.c
index c50d4bd92..f47407e5c 100644
--- a/wpa_supplicant/pr_supplicant.c
+++ b/wpa_supplicant/pr_supplicant.c
@@ -315,6 +315,9 @@  static void wpas_pr_pasn_clear_keys(void *ctx, const u8 *own_addr,
 
 struct wpabuf * wpas_pr_usd_elems(struct wpa_supplicant *wpa_s)
 {
+	if (!wpa_s->global->pr)
+		return NULL;
+
 	return pr_prepare_usd_elems(wpa_s->global->pr);
 }