From owner-svn-src-all@freebsd.org Sun Feb 14 16:11:13 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1B3EBAA8870; Sun, 14 Feb 2016 16:11:13 +0000 (UTC) (envelope-from andriyvos@gmail.com) Received: from mail-lb0-f179.google.com (mail-lb0-f179.google.com [209.85.217.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9C47F1204; Sun, 14 Feb 2016 16:11:12 +0000 (UTC) (envelope-from andriyvos@gmail.com) Received: by mail-lb0-f179.google.com with SMTP id bc4so66984881lbc.2; Sun, 14 Feb 2016 08:11:12 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:content-type:to:subject:references:date:cc :mime-version:content-transfer-encoding:from:message-id:in-reply-to :user-agent; bh=UsdTHe/1srRJ49Uhml3HHjAezLsmsmWXCttGzhmlzGg=; b=HB8Q0bNq0rEKDUkaIM6EcnlbSxDlfmM2qwCoa/PepYzrRW/FfXTq6cqKQBOJw3zxtn DPxotx+hPxS2nZ/VyUZ7XTqOKu3yXyN5J3OQyDi3C26N0Zzqoc8EQetbZVvZmZCrvvuD U+VRxXsS9mTcM2zdyT4Q4VM1YnHbFjwr9er/zEdUxOWE8lPo4NXPlQgkKOMcEjv5Cw3w Z3bmJw19/UnsyudioHLIJzuTLncIUg+jkk+5zqOOl1jRoHIj2UF+DgoBJSXFgijdIqgQ KItLDmr7cBdM61eoHok2pV6FlMHNvPgo38AYogYr6MFAkF294X6Kg1RU1G9bpEfrCnx5 f2yQ== X-Gm-Message-State: AG10YOT2k5Zw5zLr9WJI9JP9Dh3zmKONu11M88M21cNGpigKa4uWAi3TyXWuldw8/M+6+Q== X-Received: by 10.112.151.134 with SMTP id uq6mr3872398lbb.18.1455462805555; Sun, 14 Feb 2016 07:13:25 -0800 (PST) Received: from localhost (host-176-37-109-22.la.net.ua. [176.37.109.22]) by smtp.gmail.com with ESMTPSA id h8sm3002037lbd.48.2016.02.14.07.13.24 (version=TLS1 cipher=AES128-SHA bits=128/128); Sun, 14 Feb 2016 07:13:25 -0800 (PST) Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes To: "Hans Petter Selasky" Subject: Re: svn commit: r295607 - head/sys/dev/usb/wlan References: <201602140716.u1E7Gaot040504@repo.freebsd.org> Date: Sun, 14 Feb 2016 17:13:25 +0200 Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" MIME-Version: 1.0 Content-Transfer-Encoding: Quoted-Printable From: "Andriy Voskoboinyk" Message-ID: In-Reply-To: <201602140716.u1E7Gaot040504@repo.freebsd.org> User-Agent: Opera Mail/12.16 (FreeBSD) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Feb 2016 16:11:13 -0000 Sun, 14 Feb 2016 09:16:36 +0200 =D0=B1=D1=83=D0=BB=D0=BE =D0=BD=D0=B0=D0= =BF=D0=B8=D1=81=D0=B0=D0=BD=D0=BE Hans Petter Selasky = : > 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 Hardware crypto support was never merged (so, there is nothing to MFC). > > 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 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D > --- 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) > ... > --- skipped --- > ... > Modified: head/sys/dev/usb/wlan/if_rumreg.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D > --- head/sys/dev/usb/wlan/if_rumreg.h Sun Feb 14 02:28:59 2016 (r29560= 6) > +++ head/sys/dev/usb/wlan/if_rumreg.h Sun Feb 14 07:16:36 2016 (r29560= 7) > @@ -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 + \ > Reason of this change? (device table has 64 entries, not 8). I have not seen any overflows, caused by it: 1) vap->iv_key_set =3D rum_key_set; vap->iv_key_delete =3D rum_key_delete; vap->iv_update_beacon =3D rum_update_beacon; vap->iv_max_aid =3D RT2573_ADDR_MAX; // not the case usb_callout_init_mtx(&rvp->ratectl_ch, &sc->sc_mtx, 0); TASK_INIT(&rvp->ratectl_task, 0, rum_ratectl_task, rvp); 2) k < &vap->iv_nw_keys[IEEE80211_WEP_NKID])) { if (!(k->wk_flags & IEEE80211_KEY_SWCRYPT)) { RUM_LOCK(sc); for (i =3D 0; i < RT2573_ADDR_MAX; i++) { // can hold [0;63] wit= hout = any overflows; // keys_bmap is 64-bit, so there is no overflow too if ((sc->keys_bmap & (1ULL << i)) =3D=3D 0) { sc->keys_bmap |=3D 1ULL << i; *keyix =3D i; 3) } } RUM_UNLOCK(sc); if (i =3D=3D RT2573_ADDR_MAX) { // like the first case device_printf(sc->sc_dev, "%s: no free space in the key table\n", __func__);