This repository was archived by the owner on Feb 20, 2026. It is now read-only.
fix: reorder HIF init before WiFi wake-up to prevent NULL pointer crash#24
Open
akoscz wants to merge 2 commits intohmtheboy154:mainfrom
Open
fix: reorder HIF init before WiFi wake-up to prevent NULL pointer crash#24akoscz wants to merge 2 commits intohmtheboy154:mainfrom
akoscz wants to merge 2 commits intohmtheboy154:mainfrom
Conversation
Automatically detect if the kernel was built with clang by checking CONFIG_CC_IS_CLANG in the kernel's autoconf.h. This ensures the driver is built with the same compiler toolchain as the kernel, which is required for ABI compatibility. Changes: - Add compiler detection to Makefile and Makefile.x86 - Set CC=clang and LLVM=1 flags when clang kernel detected - Apply compiler-specific warning suppressions - Use LLVM_FLAGS variable to reduce duplication Tested on CachyOS with clang-built 6.18.8-3-cachyos kernel.
When WiFi hardware is already powered on during driver initialization (e.g., after a system crash or when firmware persists across reboots), wlanWakeUpWiFi() calls wlanPowerOffWifi() to cleanly reset the hardware. However, wlanPowerOffWifi() sends commands through the TX DMA rings, which are allocated in halHifSwInfoInit(). The original initialization order in wlanAdapterStart() was: 1. wlanWakeUpWiFi() - may call wlanPowerOffWifi() if WiFi is ON 2. halHifSwInfoInit() - allocates TX DMA rings This caused a NULL pointer dereference in halWpdmaWriteCmd() when accessing pTxCell->AllocVa on uninitialized TX rings. Fix by reordering initialization so halHifSwInfoInit() is called before wlanWakeUpWiFi(), ensuring TX DMA rings are always available before any code attempts to send commands. Fixes hmtheboy154#22
|
I have seen this on my systems. Please continue your own testing. I hope to validate this shortly. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
wlanAdapterStart()sohalHifSwInfoInit()is called beforewlanWakeUpWiFi()Problem
When WiFi hardware is already powered on during driver probe (e.g., after unclean shutdown),
wlanWakeUpWiFi()callswlanPowerOffWifi()to reset the hardware. This sends commands through TX DMA rings, buthalHifSwInfoInit()(which allocates these rings) wasn't called until afterwlanWakeUpWiFi()returned.Note:
HAL_HIF_INITinsidewlanWakeUpWiFi()is a no-op for PCIE - the real allocation happens inhalHifSwInfoInit().Test plan
Fixes #22