Skip to content

Commit 444020f

Browse files
committed
wifi: cfg80211: remove scan request n_channels counted_by
This reverts commit e3eac9f ("wifi: cfg80211: Annotate struct cfg80211_scan_request with __counted_by"). This really has been a completely failed experiment. There were no actual bugs found, and yet at this point we already have four "fixes" to it, with nothing to show for but code churn, and it never even made the code any safer. In all of the cases that ended up getting "fixed", the structure is also internally inconsistent after the n_channels setting as the channel list isn't actually filled yet. You cannot scan with such a structure, that's just wrong. In mac80211, the struct is also reused multiple times, so initializing it once is no good. Some previous "fixes" (e.g. one in brcm80211) are also just setting n_channels before accessing the array, under the assumption that the code is correct and the array can be accessed, further showing that the whole thing is just pointless when the allocation count and use count are not separate. If we really wanted to fix it, we'd need to separately track the number of channels allocated and the number of channels currently used, but given that no bugs were found despite the numerous syzbot reports, that'd just be a waste of time. Remove the __counted_by() annotation. We really should also remove a number of the n_channels settings that are setting up a structure that's inconsistent, but that can wait. Reported-by: [email protected] Closes: https://syzkaller.appspot.com/bug?extid=e834e757bd9b3d3e1251 Fixes: e3eac9f ("wifi: cfg80211: Annotate struct cfg80211_scan_request with __counted_by") Link: https://patch.msgid.link/20250714142130.9b0bbb7e1f07.I09112ccde72d445e11348fc2bef68942cb2ffc94@changeid Signed-off-by: Johannes Berg <[email protected]>
1 parent 2aec790 commit 444020f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/net/cfg80211.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2690,7 +2690,7 @@ struct cfg80211_scan_request {
26902690
s8 tsf_report_link_id;
26912691

26922692
/* keep last */
2693-
struct ieee80211_channel *channels[] __counted_by(n_channels);
2693+
struct ieee80211_channel *channels[];
26942694
};
26952695

26962696
static inline void get_random_mask_addr(u8 *buf, const u8 *addr, const u8 *mask)

0 commit comments

Comments
 (0)