On 10/29/2024 6:22 AM, Aleksei Vetrov wrote:
The channels array in the cfg80211_scan_request has a __counted_by attribute attached to it, which points to the n_channels variable. This attribute is used in bounds checking, and if it is not set before the array is filled, then the bounds sanitizer will issue a warning or a kernel panic if CONFIG_UBSAN_TRAP is set.
This patch sets the size of allocated memory as the initial value for n_channels. It is updated with the actual number of added elements after the array is filled.
Fixes: aa4ec06c455d ("wifi: cfg80211: use __counted_by where appropriate") Cc: stable@vger.kernel.org Signed-off-by: Aleksei Vetrov vvvvvv@google.com
Reviewed-by: Jeff Johnson quic_jjohnson@quicinc.com
And it is exactly this kind of issue why I'm not accepting any __counted_by() changes in ath.git without actually testing the code that is modified.
/jeff