Search Linux Wireless

Re: [PATCH] wifi: mt76: mt7996: avoid potential null deref in mt7996_get_et_stats()

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

 



> Ensure phy->mib is only accessed after the null sanity check for phy
> otherwise the code may trigger a potential null deref.

* Would you like to use the term “null pointer dereference” consistently?

* Were any known source code analysis tools involved also for
  this software improvement?


…
> +++ b/drivers/net/wireless/mediatek/mt76/mt7996/main.c
…
> @@ -1886,6 +1886,8 @@ void mt7996_get_et_stats(struct ieee80211_hw *hw,
>  	if (!phy)
>  		return;
>
> +	mib = &phy->mib;
> +
>  	mutex_lock(&dev->mt76.mutex);
>
>  	mt7996_mac_update_stats(phy);

I suggest to move such an assignment statement directly before the place
where this variable is used finally.

Regards,
Markus





[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux