Search Linux Wireless

[PATCH] ath9k_hw: avoid division-by-zero in ani

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

 



The ath9k ANI code may under some circumstances do division-by-zero. This 
patch detects and avoids that case.

Reported-by: Ben Greear <greearb@xxxxxxxxxxxxxxx>
Signed-off-by: Björn Smedman <bjorn.smedman@xxxxxxxxxxx>
---
diff --git a/drivers/net/wireless/ath/ath9k/ani.c b/drivers/net/wireless/ath/ath9k/ani.c
index 3aa8fb1..50a7f89 100644
--- a/drivers/net/wireless/ath/ath9k/ani.c
+++ b/drivers/net/wireless/ath/ath9k/ani.c
@@ -713,6 +713,9 @@ void ath9k_hw_ani_monitor(struct ath_hw *ah, struct ath9k_channel *chan)
 
 	ath9k_hw_ani_read_counters(ah);
 
+	if (WARN_ON(aniState->listenTime == 0))
+		return;
+
 	ofdmPhyErrRate = aniState->ofdmPhyErrCount * 1000 /
 			 aniState->listenTime;
 	cckPhyErrRate =  aniState->cckPhyErrCount * 1000 /

[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux