This repository was archived by the owner on Feb 20, 2026. It is now read-only.
fix: stability improvements and wlanSendCommand error handling#28
Open
akoscz wants to merge 4 commits intohmtheboy154:mainfrom
Open
fix: stability improvements and wlanSendCommand error handling#28akoscz wants to merge 4 commits intohmtheboy154:mainfrom
akoscz wants to merge 4 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.
…CE warning Fixes hmtheboy154#21 The kernel's FORTIFY_SOURCE detected a buffer overflow when copying SSIDs into the aucOptInfo field because it was declared as a 1-byte array (old-style flexible array pattern) but used to store up to 32 bytes. Changes: - include/nic/mac.h: Change aucOptInfo[1] to aucOptInfo[] (C99 flexible array member) - mgmt/ais_fsm.c: Change buffer size from +31 to +ELEM_MAX_LEN_SSID to maintain correct 32-byte SSID capacity after sizeof change The dynamic allocation in wlan_oid.c (u4SetBufferLen + sizeof(*prSSIDIE)) now allocates exactly the right amount instead of 1 byte over.
- Use C99 flexible array member for SUB_ELEMENT.aucOptInfo to eliminate FORTIFY_SOURCE warnings about writes beyond field size - Update buffer size in aisSendNeighborRequest() to use ELEM_MAX_LEN_SSID constant instead of hardcoded 31 - Add missing NULL check after kalMemAlloc() in wlanQueryPdMcr() to prevent NULL pointer dereference under memory pressure - Use fallthrough macro instead of comment for switch case fallthrough to fix -Wimplicit-fallthrough warning - Add block scope around variable declaration after case label to fix -Wc23-extensions warning in kalProcessCfg80211RxPkt()
Add error checking for wlanSendCommand() calls in: - wlanQueryNicCapability() - wlanQueryPdMcr() - wlanQueryNicCapabilityV2() Previously these functions called wlanSendCommand() without checking if it succeeded, then waited for a response that would never come if the command failed to send. The check handles both WLAN_STATUS_SUCCESS and WLAN_STATUS_PENDING as success cases, since wlanSendCommand() returns PENDING for query commands that need a response. WLAN_STATUS_FAILURE and WLAN_STATUS_RESOURCES are treated as errors. On failure, resources are properly cleaned up (prCmdInfo and aucBuffer where applicable) before returning.
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
Two stability fixes for the mt7902 driver, improving error handling and fixing compiler warnings.
Depends on #23 (branched from
fix-fortify-source-overflow).Changes
1. fix: stability improvements and compiler warning fixes
kalMemAlloc()inwlanQueryPdMcr()to prevent NULL pointer dereference under memory pressurefallthroughmacro instead of/* Fall through */comment inp2pFuncValidateRxActionFrame()to fix-Wimplicit-fallthroughwarningkalProcessCfg80211RxPkt()to fix-Wc23-extensionswarning on kernel 6.1+2. fix: check wlanSendCommand return value before waiting for response
Three call sites (
wlanQueryNicCapability,wlanQueryPdMcr,wlanQueryNicCapabilityV2) were ignoring the return value ofwlanSendCommand(). If the send fails, the code proceeds to wait for a response that will never arrive, leading to a timeout or hang. Now checks the return value and bails out with proper resource cleanup on failure.