Skip to content

Commit bf41c16

Browse files
D-Trivenikrish2718
authored andcommitted
[nrf fromlist] drivers: wifi: nrf_wifi: Fix invalid pointer access
Fix pointer dereferencing by accessing the pointer only after initialization, preventing fault exceptions. Upstream PR #: 97183 Signed-off-by: Triveni Danda <[email protected]> (cherry picked from commit 18f5a4e)
1 parent e17587a commit bf41c16

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

drivers/wifi/nrf_wifi/src/wifi_mgmt.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -875,18 +875,6 @@ int nrf_wifi_channel(const struct device *dev,
875875
return ret;
876876
}
877877

878-
for (i = 0; i < MAX_PEERS; i++) {
879-
peer = &sys_dev_ctx->tx_config.peers[i];
880-
if (peer->peer_id == -1) {
881-
continue;
882-
}
883-
if (peer->authorized) {
884-
LOG_ERR("%s: Cannot change channel when in station connected mode",
885-
__func__);
886-
return ret;
887-
}
888-
}
889-
890878
rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep;
891879
if (!rpu_ctx_zep) {
892880
LOG_ERR("%s: rpu_ctx_zep is NULL", __func__);
@@ -902,6 +890,18 @@ int nrf_wifi_channel(const struct device *dev,
902890
fmac_dev_ctx = rpu_ctx_zep->rpu_ctx;
903891
sys_dev_ctx = wifi_dev_priv(fmac_dev_ctx);
904892

893+
for (i = 0; i < MAX_PEERS; i++) {
894+
peer = &sys_dev_ctx->tx_config.peers[i];
895+
if (peer->peer_id == -1) {
896+
continue;
897+
}
898+
if (peer->authorized) {
899+
LOG_ERR("%s: Cannot change channel when in station connected mode",
900+
__func__);
901+
return ret;
902+
}
903+
}
904+
905905
if (channel->oper == WIFI_MGMT_SET) {
906906
/**
907907
* Send the driver vif_idx instead of upper layer sent if_index.

0 commit comments

Comments
 (0)