Received: by 2002:a25:b323:0:0:0:0:0 with SMTP id l35csp1545402ybj; Fri, 20 Sep 2019 12:13:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqwAHFi/ah+jpDZ+Ti3752H3HYfPxhZQ4oy7IMc+WnBj1gXRaTfEfH5qQnYOzzeRZiUrC7BR X-Received: by 2002:a05:6402:32f:: with SMTP id q15mr21294140edw.143.1569006796399; Fri, 20 Sep 2019 12:13:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569006796; cv=none; d=google.com; s=arc-20160816; b=NB0nyFnSexFoNzv0cLOPoNVeAPkdSFGtxtHsnmTm8PcOjOPJSvTj01/WAj5TXnLDxv jhHYUAL30UMZ+IKZPULILoqZgo20yhXLUxoPv/8wy6LCXMTjIShKmoMpz4Nzz59LCty2 VfSffFNgV5RvvxjnBFzBUrFRBbWumJJpqTlVp6gFLjZ2lwUXiUdjmRCBXE5tOsx+Pdd5 MaR+lqtFzwdjyHEPbsHy3EOC63+LCgag9kQ5X1zxlB9THMzoFjQ4dXfRIvkFOwLe/cm0 LN6IsCu9cd6+wDvgtB/JGcVB+hBLvUuyl1J2qZ4pf/5+MljK1DjmobGN6gc3PY7DKQRJ HgwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=o3K2l9oeYYZiA4zloA7Tn2OhFQ1REuHDd7KimONjn30=; b=QZZVpCyU6VJJV8lKh1qDbOCIMiCe5CrP93K+B3TZHKptV8agkxLs0DleadYP3kLmGK KLGR2N12U84Yxd4q0ZnFvzHe+0xE7pM3Clx6eekScat3F5917flQLNMCLH5niOXUOKOr WXw1FPjljyRhGjc/7w46Eza75t0rDJAmc0xFzKEClcl2PioOgvRCQXp6aun1l/1Jc7Jo RajMZaiIQlvqK/Wm1ffNCvZf1NabUs5OPH3n+W+RtkMhHFz1gBCWK4j9ksdBjgCNpGaL sA0+T4vCMYrS5HxNbC3PoOKkKPl/v6TfAmzdLX97nlWOpIyQBuVJ56zaxpoupAU52Tha brJw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d35si1832654ede.440.2019.09.20.12.12.52; Fri, 20 Sep 2019 12:13:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2438197AbfITL2F (ORCPT + 99 others); Fri, 20 Sep 2019 07:28:05 -0400 Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:59019 "EHLO atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2438188AbfITL2F (ORCPT ); Fri, 20 Sep 2019 07:28:05 -0400 Received: by atrey.karlin.mff.cuni.cz (Postfix, from userid 512) id 40A4480FFD; Fri, 20 Sep 2019 13:27:49 +0200 (CEST) Date: Fri, 20 Sep 2019 13:28:03 +0200 From: Pavel Machek To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, Dan Carpenter , Masashi Honma , Johannes Berg Subject: Re: [PATCH 4.19 18/79] nl80211: Fix possible Spectre-v1 for CQM RSSI thresholds Message-ID: <20190920112803.GB7865@amd> References: <20190919214807.612593061@linuxfoundation.org> <20190919214809.383428098@linuxfoundation.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="5/uDoXvLw7AC5HRs" Content-Disposition: inline In-Reply-To: <20190919214809.383428098@linuxfoundation.org> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --5/uDoXvLw7AC5HRs Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > commit 4b2c5a14cd8005a900075f7dfec87473c6ee66fb upstream. >=20 > commit 1222a1601488 ("nl80211: Fix possible Spectre-v1 for CQM > RSSI thresholds") was incomplete and requires one more fix to > prevent accessing to rssi_thresholds[n] because user can control > rssi_thresholds[i] values to make i reach to n. For example, > rssi_thresholds =3D {-400, -300, -200, -100} when last is -34. > @@ -10270,9 +10270,11 @@ static int cfg80211_cqm_rssi_update(stru > hyst =3D wdev->cqm_config->rssi_hyst; > n =3D wdev->cqm_config->n_rssi_thresholds; > =20 > - for (i =3D 0; i < n; i++) > + for (i =3D 0; i < n; i++) { > + i =3D array_index_nospec(i, n); > if (last < wdev->cqm_config->rssi_thresholds[i]) > break; > + } > =20 Variable "i" is not controlled by userspace: it is initialized by kernel and runs from 0 to n. I don't see a spectre vulnerability here. [In fact, other array_index_nospec() uses in this function seem also unneccessary.] Best regards, Pavel --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --5/uDoXvLw7AC5HRs Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAl2Et8MACgkQMOfwapXb+vJqxQCfdRihxvPW6Qr9626ZJozDV8Lf xFcAoJwcJWyP3GPk1hlsmm4QZA53vhkI =0z8r -----END PGP SIGNATURE----- --5/uDoXvLw7AC5HRs--