← Back to Pull requests

mcux: osa/wifi_nxp: fix OSA timer handle size mismatch on AArch64 #838

Closed
unknown closed this pull request without merging on Oct 22, 2026 05:45 UTC
View on GitHub
unknown unknown commented on Oct 15, 2026 07:45 UTC
Author

Fix OSA timer handle size mismatch on AArch64 (LP64) in the Zephyr OSA port.

Problem

On AArch64, the OSA timer handle buffer allocated by
OSA_TIMER_HANDLE_DEFINE() is too small to hold the struct timer_data
used by the wifi_nxp OSA port, causing memory corruption and a
work-queue assert/panic during Wi-Fi traffic.

Two mismatched timer structure definitions existed:

  • osa_zephyr_timerHandle_t (fsl_os_abstraction_zephyr.h): used for

  • buffer allocation. Layout: {k_timer handle; k_work work; padding[4];}
    = 136 bytes. OSA_TIMER_HANDLE_SIZE = sizeof(this) = 136.
  • struct timer_data (osa_zephyr.h): used for actual access. Layout:

  • {callback; user_arg; period; reload_options; k_timer timer; k_work work;}
    = 144 bytes (24-byte prefix before k_timer/k_work).

    On AArch64, OSA_TIMER_HANDLE_SIZE (136) < sizeof(struct timer_data) (144).
    The buffer overruns into the field following the handle in the parent
    struct. In reorder_tmr_cnxt_t, timer_is_set (offset 136) aliases
    timer_data.work.flags (offset 136), causing K_WORK_RUNNING_BIT to be
    set spuriously and triggering a work->queue == NULL assert/panic.

    Fix

    1. Align osa_zephyr_timerHandle_t with the actual timer_data layout by
    replacing {k_timer handle; k_work work; padding[4]} with the full
    set of fields: {callback; user_arg; period; reload_options;
    k_timer timer; k_work work}. OSA_TIMER_HANDLE_SIZE is now always
    large enough.

    2. Replace the duplicate struct timer_data definition in osa_zephyr.h
    with a typedef alias of osa_zephyr_timerHandle_t, eliminating the
    two-structure divergence at the source.

    Testing

    Verified on frdm_imx91/mimx9131 (AArch64, Cortex-A55) with IW610:

  • UAP WPA2 + STA mode, 1-min TCP/UDP zperf traffic each direction.

  • Before fix: intermittent work->queue == NULL assert during traffic.

  • After fix: no assert, no crash in either role.
  • Diff: 232 lines (+174 / -58) across 2 files Reviewer: ZhaoxiangJin Review duration: 9960m
    All Vouch review confidence checks passed
    Residual risk 0.15 = Change Risk (0.37) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.37 · 232 lines diff across 2 files
    0.37
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.326
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #838"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 37.1% (MEDIUM) · Higher = larger blast radius
    37.1%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 14.6% · Safe to merge
    14.6%