From 10803e81b50b7bc257f9cee44a775a9a79a9abe7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rmilecki@antmicro.com>
Date: Tue, 26 Mar 2013 22:30:13 +0100
Subject: [PATCH] mac80211 fix

---
 net/mac80211/scan.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c
index cb34cbb..d23e46c 100644
--- a/net/mac80211/scan.c
+++ b/net/mac80211/scan.c
@@ -153,6 +153,7 @@ void ieee80211_scan_rx(struct ieee80211_local *local, struct sk_buff *skb)
 	u8 *elements;
 	struct ieee80211_channel *channel;
 	size_t baselen;
+	int freq;
 	struct ieee802_11_elems elems;
 
 	if (skb->len < 24 ||
@@ -184,7 +185,13 @@ void ieee80211_scan_rx(struct ieee80211_local *local, struct sk_buff *skb)
 
 	ieee802_11_parse_elems(elements, skb->len - baselen, &elems);
 
-	channel = ieee80211_get_channel(local->hw.wiphy, rx_status->freq);
+	if (elems.ds_params && elems.ds_params_len == 1)
+		freq = ieee80211_channel_to_frequency(elems.ds_params[0],
+						      rx_status->band);
+	else
+		freq = rx_status->freq;
+
+	channel = ieee80211_get_channel(local->hw.wiphy, freq);
 
 	if (!channel || channel->flags & IEEE80211_CHAN_DISABLED)
 		return;
-- 
1.7.10.4

