diff options
author | Felix Fietkau <nbd@openwrt.org> | 2012-06-27 01:10:18 +0000 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2012-06-27 01:10:18 +0000 |
commit | 3d83a7b636ec50a1d98b083ee756b505f8a21c2b (patch) | |
tree | dfc29d012c9436b9b37f6126b8b290d1cd570e0f /package/mac80211/patches/561-ath9k_antenna_mask_validate.patch | |
parent | 2479910d452cb54b2af28c391dcf56d607de2f18 (diff) | |
download | upstream-3d83a7b636ec50a1d98b083ee756b505f8a21c2b.tar.gz upstream-3d83a7b636ec50a1d98b083ee756b505f8a21c2b.tar.bz2 upstream-3d83a7b636ec50a1d98b083ee756b505f8a21c2b.zip |
ath9k: reject invalid antenna mask configurations
SVN-Revision: 32507
Diffstat (limited to 'package/mac80211/patches/561-ath9k_antenna_mask_validate.patch')
-rw-r--r-- | package/mac80211/patches/561-ath9k_antenna_mask_validate.patch | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/package/mac80211/patches/561-ath9k_antenna_mask_validate.patch b/package/mac80211/patches/561-ath9k_antenna_mask_validate.patch new file mode 100644 index 0000000000..c84162fe44 --- /dev/null +++ b/package/mac80211/patches/561-ath9k_antenna_mask_validate.patch @@ -0,0 +1,28 @@ +--- a/drivers/net/wireless/ath/ath9k/main.c ++++ b/drivers/net/wireless/ath/ath9k/main.c +@@ -1929,12 +1929,24 @@ static u32 fill_chainmask(u32 cap, u32 n + return filled; + } + ++static bool validate_antenna_mask(u32 val) ++{ ++ switch (val & 0x7) { ++ case 0x1: ++ case 0x3: ++ case 0x7: ++ return true; ++ default: ++ return false; ++ } ++} ++ + static int ath9k_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant) + { + struct ath_softc *sc = hw->priv; + struct ath_hw *ah = sc->sc_ah; + +- if (!rx_ant || !tx_ant) ++ if (!validate_antenna_mask(rx_ant) || !validate_antenna_mask(tx_ant)) + return -EINVAL; + + sc->ant_rx = rx_ant; |