RDKBACCL-1702: [TDK][AUTO][BPI][DML]Setting Device.WiFi.AccessPoint.<i>.WPS.X_CISCO_COM_CancelSession causes OneWiFi crash - #1290
Conversation
…i>.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 <Akhil_P@comcast.com>
There was a problem hiding this comment.
Pull request overview
Prevents OneWiFi crashes when TR-181 clients attempt to cancel WPS sessions on VAPs where WPS is not applicable/enabled by adding defensive guards in the relevant DML paths and the controller event handler.
Changes:
- Add a defensive check in the platform DML callback to reject
X_CISCO_COM_CancelSessionwhen WPS is disabled for the VAP. - Add a similar defensive check in the TR-181 multi-link DML handler for
X_CISCO_COM_CancelSession. - Ignore WPS-cancel events in the controller if the target VAP is not a private VAP.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| source/platform/common/data_model/wifi_dml_cb.c | Reject WPS cancel requests when WPS is disabled for the VAP. |
| source/dml/tr_181/ml/cosa_wifi_dml.c | Reject WPS cancel requests when WPS is disabled (but still needs payload sizing fix for ctrl-queue). |
| source/core/wifi_ctrl_queue_handlers.c | Ignore WPS-cancel events for non-private VAP indices before calling HAL. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
095a61b to
c464c0c
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
source/platform/common/data_model/wifi_dml_cb.c:4833
instance_numberis auint8_there, but it’s sent to the ctrl queue withlen = sizeof(instance_number)(1 byte).process_wps_cancel_event()consumes the payload as anINT(*(INT*)data), so this is still an out-of-bounds read/UB and can crash even with the new WPS-enable guard. Send a 32-bit/intvap index into the queue (consistent with the push-button path above and withcosa_wifi_dml.c).
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);
c464c0c to
892bb61
Compare
WPS_SetParamBoolValue pushed instance_number uint8_t into the ctrl queue for wifi_event_type_command_wps_cancel, but process_wps_cancel_event consumes the payload as *(INT*)data This caused an out-of-bounds read that could crash.
892bb61 to
cc1e356
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (2)
source/platform/common/data_model/wifi_dml_cb.c:4827
X_CISCO_COM_CancelSessionis a command-style boolean (getter always returns false). The setter currently triggers a cancel even whenoutput_valueis false, and will also return an error for non-WPS VAPs even for a no-op write offalse. Gate the behavior so onlytruetriggers a cancel; treatfalseas a successful no-op.
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;
source/dml/tr_181/ml/cosa_wifi_dml.c:12412
X_CISCO_COM_CancelSessionshould only perform a cancel when the written value isTRUE(command-style param; reads are always false). As written, aFALSEwrite still enqueues a cancel. Also, the queue handler now ignores non-private VAP indices; rejecting non-private VAPs here keeps behavior consistent and returns the requested error instead of a silent ignore.
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;
}
INT vap_index = (INT)(instance_number - 1);
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
source/dml/tr_181/ml/cosa_wifi_dml.c:12414
WPS_SetParamBoolValue()now guards onvapInfo->u.bss_info.wps.enable, but it still allowsX_CISCO_COM_CancelSessionon non-private VAPs when WPS happens to be enabled (the ctrl handler will ignore it due toisVapPrivate()), so the setter can report success while doing nothing. Add a private-VAP applicability check here (consistent withwebconfig_send_wps_change_event()andprocess_wps_cancel_event()).
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;
}
INT vap_index = (INT)(instance_number - 1);
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