From patchwork Fri May 27 14:24:02 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Rodriguez X-Patchwork-Id: 824302 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.3) with ESMTP id p4REOgqT019114 for ; Fri, 27 May 2011 14:24:42 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751325Ab1E0OYk (ORCPT ); Fri, 27 May 2011 10:24:40 -0400 Received: from mail.atheros.com ([12.19.149.2]:32783 "EHLO mail.atheros.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751114Ab1E0OYk (ORCPT ); Fri, 27 May 2011 10:24:40 -0400 Received: from mail.atheros.com ([10.10.20.108]) by sidewinder.atheros.com for ; Fri, 27 May 2011 07:24:08 -0700 Received: from tux (10.234.11.99) by SC1EXHC-02.global.atheros.com (10.234.20.111) with Microsoft SMTP Server (TLS) id 8.2.213.0; Fri, 27 May 2011 07:24:19 -0700 Received: by tux (sSMTP sendmail emulation); Fri, 27 May 2011 07:24:02 -0700 From: "Luis R. Rodriguez" To: , CC: , "Luis R. Rodriguez" Subject: [PATCH] cfg80211: skip disabled channels on channel survey Date: Fri, 27 May 2011 07:24:02 -0700 Message-ID: <1306506242-7552-1-git-send-email-lrodriguez@atheros.com> X-Mailer: git-send-email 1.7.4.15.g7811d MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Fri, 27 May 2011 14:24:42 +0000 (UTC) The channel survey information will be empy for disabled channels so simply discard those entries. Signed-off-by: Luis R. Rodriguez --- net/wireless/nl80211.c | 19 +++++++++++++++---- 1 files changed, 15 insertions(+), 4 deletions(-) diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index ec83f41..e283816 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -3754,10 +3754,6 @@ static int nl80211_send_survey(struct sk_buff *msg, u32 pid, u32 seq, void *hdr; struct nlattr *infoattr; - /* Survey without a channel doesn't make sense */ - if (!survey->channel) - return -EINVAL; - hdr = nl80211hdr_put(msg, pid, seq, flags, NL80211_CMD_NEW_SURVEY_RESULTS); if (!hdr) @@ -3820,6 +3816,8 @@ static int nl80211_dump_survey(struct sk_buff *skb, } while (1) { + struct ieee80211_channel *chan; + res = dev->ops->dump_survey(&dev->wiphy, netdev, survey_idx, &survey); if (res == -ENOENT) @@ -3827,6 +3825,19 @@ static int nl80211_dump_survey(struct sk_buff *skb, if (res) goto out_err; + /* Survey without a channel doesn't make sense */ + if (!survey.channel) { + res = -EINVAL; + goto out; + } + + chan = ieee80211_get_channel(&dev->wiphy, + survey.channel->center_freq); + if (!chan || chan->flags & IEEE80211_CHAN_DISABLED) { + survey_idx++; + continue; + } + if (nl80211_send_survey(skb, NETLINK_CB(cb->skb).pid, cb->nlh->nlmsg_seq, NLM_F_MULTI,