The branch stable/14 has been updated by bz:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=861bf0606a5b13ecc796c278c57b5e51830d68ba

commit 861bf0606a5b13ecc796c278c57b5e51830d68ba
Author:     Bjoern A. Zeeb <[email protected]>
AuthorDate: 2023-10-27 20:41:43 +0000
Commit:     Bjoern A. Zeeb <[email protected]>
CommitDate: 2023-11-30 00:36:57 +0000

    LinuxKPI: 802.11: deal with scan_ie_len
    
    We only need to reserve the extra space for DSSS if
    NL80211_FEATURE_DS_PARAM_SET_IE_IN_PROBES is set, so add the conditional.
    Also add checks in case scan_ie_len will grow beyond the maximum.
    Given this is currently unlikely, leave the cleanup for later as
    some other restructuring should be done first.
    
    Sponsored by:   The FreeBSD Foundation
    Reviewed by:    cc
    Differential Revision: https://reviews.freebsd.org/D42425
    
    (cherry picked from commit 78ca45df310563ca46448a124674e0542aab2e31)
---
 sys/compat/linuxkpi/common/src/linux_80211.c | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c 
b/sys/compat/linuxkpi/common/src/linux_80211.c
index aba7e0e961a6..ffda3c5693cd 100644
--- a/sys/compat/linuxkpi/common/src/linux_80211.c
+++ b/sys/compat/linuxkpi/common/src/linux_80211.c
@@ -3919,20 +3919,30 @@ linuxkpi_ieee80211_ifattach(struct ieee80211_hw *hw)
        lhw->scan_ie_len = 2 + IEEE80211_RATE_SIZE;
        if (lhw->max_rates > IEEE80211_RATE_SIZE)
                lhw->scan_ie_len += 2 + (lhw->max_rates - IEEE80211_RATE_SIZE);
-       /*
-        * net80211 does not seem to support the DSSS Parameter Set but some of
-        * the drivers insert it so calculate the extra fixed space in.
-        */
-       lhw->scan_ie_len += 2 + 1;
+
+       if (hw->wiphy->features & NL80211_FEATURE_DS_PARAM_SET_IE_IN_PROBES) {
+               /*
+                * net80211 does not seem to support the DSSS Parameter Set but
+                * some of the drivers insert it so calculate the extra fixed
+                * space in.
+                */
+               lhw->scan_ie_len += 2 + 1;
+       }
 
        /* Reduce the max_scan_ie_len "left" by the amount we consume already. 
*/
-       if (hw->wiphy->max_scan_ie_len > 0)
+       if (hw->wiphy->max_scan_ie_len > 0) {
+               if (lhw->scan_ie_len > hw->wiphy->max_scan_ie_len)
+                       goto err;
                hw->wiphy->max_scan_ie_len -= lhw->scan_ie_len;
+       }
 
        if (bootverbose)
                ieee80211_announce(ic);
 
        return (0);
+err:
+       IMPROVE("TODO FIXME CLEANUP");
+       return (-EAGAIN);
 }
 
 void

Reply via email to