Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src-draft/trunk]: src/sys/net80211 Verify the ic's get_radiocaps callback works



details:   https://anonhg.NetBSD.org/src-all/rev/0c49f3eba1a7
branches:  trunk
changeset: 362893:0c49f3eba1a7
user:      Martin Husemann <martin%NetBSD.org@localhost>
date:      Mon Jan 18 11:45:37 2021 +0100

description:
Verify the ic's get_radiocaps callback works

Strengthen the KASSERTMSG to also make sure data for at least one
channel has been provided.
While there cleanup allocation of temporary data (does not need
NOWAIT, only ever happens at attach time or in the ioctl path).

diffstat:

 sys/net80211/ieee80211_ioctl.c |  4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diffs (21 lines):

diff -r 4737271ac08b -r 0c49f3eba1a7 sys/net80211/ieee80211_ioctl.c
--- a/sys/net80211/ieee80211_ioctl.c    Sat Jan 16 20:06:00 2021 +0100
+++ b/sys/net80211/ieee80211_ioctl.c    Mon Jan 18 11:45:37 2021 +0100
@@ -853,7 +853,7 @@
                maxchans = 2048;
        dc = (struct ieee80211_devcaps_req *)
            IEEE80211_ZALLOC(IEEE80211_DEVCAPS_SIZE(maxchans), M_TEMP,
-           IEEE80211_M_NOWAIT);
+           IEEE80211_M_WAITOK);
        if (dc == NULL)
                return ENOMEM;
        dc->dc_drivercaps = ic->ic_caps;
@@ -862,7 +862,7 @@
        dc->dc_vhtcaps = ic->ic_vhtcaps;
        ci = &dc->dc_chaninfo;
        ic->ic_getradiocaps(ic, maxchans, &ci->ic_nchans, ci->ic_chans);
-       KASSERTMSG(ci->ic_nchans <= maxchans,
+       KASSERTMSG(ci->ic_nchans <= maxchans && ci->ic_nchans >= 1,
            "nchans %d maxchans %d", ci->ic_nchans, maxchans);
        ieee80211_sort_channels(ci->ic_chans, ci->ic_nchans);
        error = copyout(dc, ireq->i_data, IEEE80211_DEVCAPS_SPACE(dc));



Home | Main Index | Thread Index | Old Index