Re: [PATCH 4.19 18/79] nl80211: Fix possible Spectre-v1 for CQM RSSI thresholds

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

 



Hi!

> commit 4b2c5a14cd8005a900075f7dfec87473c6ee66fb upstream.
> 
> 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 = {-400, -300, -200, -100} when last is -34.

> @@ -10270,9 +10270,11 @@ static int cfg80211_cqm_rssi_update(stru
>  	hyst = wdev->cqm_config->rssi_hyst;
>  	n = wdev->cqm_config->n_rssi_thresholds;
>  
> -	for (i = 0; i < n; i++)
> +	for (i = 0; i < n; i++) {
> +		i = array_index_nospec(i, n);
>  		if (last < wdev->cqm_config->rssi_thresholds[i])
>  			break;
> +	}
>  

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
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux