From 4eecfa067c07279f7483e957275cb6a196691dda Mon Sep 17 00:00:00 2001 From: ap934 Date: Thu, 23 Jul 2026 14:12:42 +0000 Subject: [PATCH] RDKBACCL-1702: [TDK][AUTO][BPI][DML]Setting Device.WiFi.AccessPoint..WPS.X_CISCO_COM_CancelSession causes OneWiFi crash Reason for change: Setting WPS cancel on non-wps vaps causing onewifi crash, added defensive guard in respective event handlers Test Procedure: WPS functionality should work, WPS cancel should work for accesspoint 1 and 2, rest non-wps vaps are returned with error Risks: Low Priority: P2 Signed-off-by: ap934 --- source/core/wifi_ctrl_queue_handlers.c | 6 ++++++ source/dml/tr_181/ml/cosa_wifi_dml.c | 4 ++++ source/platform/common/data_model/wifi_dml_cb.c | 6 ++++++ 3 files changed, 16 insertions(+) diff --git a/source/core/wifi_ctrl_queue_handlers.c b/source/core/wifi_ctrl_queue_handlers.c index ca1756e06..301bf7ddc 100644 --- a/source/core/wifi_ctrl_queue_handlers.c +++ b/source/core/wifi_ctrl_queue_handlers.c @@ -3211,6 +3211,12 @@ static void process_wps_cancel_event(void *data) INT vap_index = *(INT*)data; + if (!isVapPrivate(vap_index)) { + wifi_util_error_print(WIFI_CTRL,"%s:%d WPS not applicable for vap index %d, ignoring cancel\n", + __func__, __LINE__, vap_index); + return; + } + wifi_util_info_print(WIFI_CTRL,"%s:%d wps pbc cancel vap index = %d\n", __func__, __LINE__, vap_index); wifi_hal_setApWpsCancel(vap_index); diff --git a/source/dml/tr_181/ml/cosa_wifi_dml.c b/source/dml/tr_181/ml/cosa_wifi_dml.c index b078c8438..2f33ff8eb 100755 --- a/source/dml/tr_181/ml/cosa_wifi_dml.c +++ b/source/dml/tr_181/ml/cosa_wifi_dml.c @@ -12413,6 +12413,10 @@ WPS_SetParamBoolValue } if( AnscEqualString(ParamName, "X_CISCO_COM_CancelSession", TRUE)) { + if (vapInfo->u.bss_info.wps.enable == false) { + wifi_util_error_print(WIFI_DMCLI,"%s:%d: WPS not enabled for %s, cancel session not supported\n",__func__, __LINE__, vapInfo->vap_name); + return FALSE; + } instance_number -= 1; wifi_util_dbg_print(WIFI_DMCLI,"%s:%d: WPS cancel for vap %d\n",__func__, __LINE__, instance_number); push_event_to_ctrl_queue(&instance_number, sizeof(instance_number), wifi_event_type_command, wifi_event_type_command_wps_cancel, NULL); diff --git a/source/platform/common/data_model/wifi_dml_cb.c b/source/platform/common/data_model/wifi_dml_cb.c index eb3c97044..4a58797e7 100644 --- a/source/platform/common/data_model/wifi_dml_cb.c +++ b/source/platform/common/data_model/wifi_dml_cb.c @@ -4821,6 +4821,12 @@ bool wps_set_param_bool_value(void *obj_ins_context, char *param_name, bool outp } } } else if (STR_CMP(param_name, "X_CISCO_COM_CancelSession")) { + if (p_dm_vap_info->u.bss_info.wps.enable == false) { + wifi_util_error_print(WIFI_DMCLI, + "%s:%d: WPS not enabled for %s, cancel session not supported\n", + __func__, __LINE__, p_dm_vap_info->vap_name); + return false; + } instance_number -= 1; wifi_util_dbg_print(WIFI_DMCLI, "%s:%d: WPS cancel for vap %d\n", __func__, __LINE__, instance_number);