Date: Sun, 14 Feb 2016 07:23:40 -0800 From: Adrian Chadd <adrian.chadd@gmail.com> To: Hans Petter Selasky <hselasky@freebsd.org>, Andriy Voskoboinyk <s3erios@gmail.com> Cc: "src-committers@freebsd.org" <src-committers@freebsd.org>, "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>, "svn-src-head@freebsd.org" <svn-src-head@freebsd.org> Subject: Re: svn commit: r295607 - head/sys/dev/usb/wlan Message-ID: <CAJ-Vmo=9cCtdY5_a_mQVm5h5an7F=H75uw7LYu9uK3UEA5n0Vg@mail.gmail.com> In-Reply-To: <201602140716.u1E7Gaot040504@repo.freebsd.org> References: <201602140716.u1E7Gaot040504@repo.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
uhm, why'd you not just file a separate pr for this? 8 keys limits how many stations it can support in hostap mode :( I'd rather the bitmap management code gets fixed. -a On 13 February 2016 at 23:16, Hans Petter Selasky <hselasky@freebsd.org> wrote: > Author: hselasky > Date: Sun Feb 14 07:16:36 2016 > New Revision: 295607 > URL: https://svnweb.freebsd.org/changeset/base/295607 > > Log: > Reduce the number of supported WLAN keys in the rum driver, else we > risk bit shifting overflows. Found by D5245 / PVS. > > MFC after: 1 week > > Modified: > head/sys/dev/usb/wlan/if_rum.c > head/sys/dev/usb/wlan/if_rumreg.h > > Modified: head/sys/dev/usb/wlan/if_rum.c > ============================================================================== > --- head/sys/dev/usb/wlan/if_rum.c Sun Feb 14 02:28:59 2016 (r295606) > +++ head/sys/dev/usb/wlan/if_rum.c Sun Feb 14 07:16:36 2016 (r295607) > @@ -2732,7 +2732,7 @@ rum_pair_key_del_cb(struct rum_softc *sc > DPRINTF("%s: removing key %d\n", __func__, k->wk_keyix); > rum_clrbits(sc, (k->wk_keyix < 32) ? RT2573_SEC_CSR2 : RT2573_SEC_CSR3, > 1 << (k->wk_keyix % 32)); > - sc->keys_bmap &= ~(1 << k->wk_keyix); > + sc->keys_bmap &= ~(1ULL << k->wk_keyix); > if (--sc->vap_key_count[rvp_id] == 0) > rum_clrbits(sc, RT2573_SEC_CSR4, 1 << rvp_id); > } > @@ -2749,8 +2749,8 @@ rum_key_alloc(struct ieee80211vap *vap, > if (!(k->wk_flags & IEEE80211_KEY_SWCRYPT)) { > RUM_LOCK(sc); > for (i = 0; i < RT2573_ADDR_MAX; i++) { > - if ((sc->keys_bmap & (1 << i)) == 0) { > - sc->keys_bmap |= 1 << i; > + if ((sc->keys_bmap & (1ULL << i)) == 0) { > + sc->keys_bmap |= (1ULL << i); > *keyix = i; > break; > } > > Modified: head/sys/dev/usb/wlan/if_rumreg.h > ============================================================================== > --- head/sys/dev/usb/wlan/if_rumreg.h Sun Feb 14 02:28:59 2016 (r295606) > +++ head/sys/dev/usb/wlan/if_rumreg.h Sun Feb 14 07:16:36 2016 (r295607) > @@ -47,7 +47,7 @@ > * H/w encryption/decryption support > */ > #define KEY_SIZE (IEEE80211_KEYBUF_SIZE + IEEE80211_MICBUF_SIZE) > -#define RT2573_ADDR_MAX 64 > +#define RT2573_ADDR_MAX (32 / RT2573_SKEY_MAX) > #define RT2573_SKEY_MAX 4 > > #define RT2573_SKEY(vap, kidx) (0x1000 + ((vap) * RT2573_SKEY_MAX + \ >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAJ-Vmo=9cCtdY5_a_mQVm5h5an7F=H75uw7LYu9uK3UEA5n0Vg>