From patchwork Thu Jan 19 10:01:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arend van Spriel X-Patchwork-Id: 9525373 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DEB63601AE for ; Thu, 19 Jan 2017 10:01:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D0EE022376 for ; Thu, 19 Jan 2017 10:01:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C598828500; Thu, 19 Jan 2017 10:01:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3062122376 for ; Thu, 19 Jan 2017 10:01:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751279AbdASKBm (ORCPT ); Thu, 19 Jan 2017 05:01:42 -0500 Received: from lpdvsmtp01.broadcom.com ([192.19.211.62]:51542 "EHLO relay.smtp.broadcom.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750975AbdASKBl (ORCPT ); Thu, 19 Jan 2017 05:01:41 -0500 Received: from mail-irv-17.broadcom.com (smtphost.broadcom.com [10.15.198.34]) by relay.smtp.broadcom.com (Postfix) with ESMTP id C46DB280062; Thu, 19 Jan 2017 02:01:38 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.10.3 relay.smtp.broadcom.com C46DB280062 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1484820098; bh=9uSkKqMCyNDsK5su+jnIqi6bCceubo+nNDddh9+Qq6U=; h=From:To:Cc:Subject:Date:From; b=pYSPvtdMK35lV2hIKGzs3YDfzynHq7hPyDEOkR36+/MQYeIdj6mCwe448geU8Od1q P/uJAloSx8bBO3DV0h35vQEgqBoW/BFdtkP9a3IhtE0ukh/WobmL6nkWN7Xr0x4GwR pnQQ1qcsvsNyWISVbTscFh+XiTzfZoh0RiDkP9aU= Received: from jenkins-cam-14.cam.broadcom.com (jenkins-cam-14.cam.broadcom.com [10.177.128.77]) by mail-irv-17.broadcom.com (Postfix) with ESMTP id 0CD9382029; Thu, 19 Jan 2017 02:01:38 -0800 (PST) Received: by jenkins-cam-14.cam.broadcom.com (Postfix, from userid 25152) id 19947B85080; Thu, 19 Jan 2017 10:01:37 +0000 (GMT) From: Arend van Spriel To: Johannes Berg Cc: linux-wireless , Arend van Spriel , Luciano Coelho Subject: [PATCH] nl80211: fix validation of scheduled scan info for wowlan netdetect Date: Thu, 19 Jan 2017 10:01:28 +0000 Message-Id: <1484820088-24448-1-git-send-email-arend.vanspriel@broadcom.com> X-Mailer: git-send-email 1.9.1 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP For wowlan netdetect a separate limit is defined for the number of matchsets. Currently, this limit is ignored and the regular limit for scheduled scan matchsets, ie. struct wiphy::max_match_sets, is used for the net-detect case as well. Cc: Luciano Coelho Signed-off-by: Arend van Spriel Reviewed-by: Luca Coelho --- net/wireless/nl80211.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index b4e7bdd..df0675d 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -6852,7 +6852,7 @@ static int nl80211_abort_scan(struct sk_buff *skb, struct genl_info *info) static struct cfg80211_sched_scan_request * nl80211_parse_sched_scan(struct wiphy *wiphy, struct wireless_dev *wdev, - struct nlattr **attrs) + struct nlattr **attrs, int max_match_sets) { struct cfg80211_sched_scan_request *request; struct nlattr *attr; @@ -6917,7 +6917,7 @@ static int nl80211_abort_scan(struct sk_buff *skb, struct genl_info *info) if (!n_match_sets && default_match_rssi != NL80211_SCAN_RSSI_THOLD_OFF) n_match_sets = 1; - if (n_match_sets > wiphy->max_match_sets) + if (n_match_sets > max_match_sets) return ERR_PTR(-EINVAL); if (attrs[NL80211_ATTR_IE]) @@ -7217,7 +7217,8 @@ static int nl80211_start_sched_scan(struct sk_buff *skb, return -EINPROGRESS; sched_scan_req = nl80211_parse_sched_scan(&rdev->wiphy, wdev, - info->attrs); + info->attrs, + rdev->wiphy.max_match_sets); err = PTR_ERR_OR_ZERO(sched_scan_req); if (err) @@ -10030,7 +10031,8 @@ static int nl80211_parse_wowlan_nd(struct cfg80211_registered_device *rdev, if (err) goto out; - trig->nd_config = nl80211_parse_sched_scan(&rdev->wiphy, NULL, tb); + trig->nd_config = nl80211_parse_sched_scan(&rdev->wiphy, NULL, tb, + wowlan->max_nd_match_sets); err = PTR_ERR_OR_ZERO(trig->nd_config); if (err) trig->nd_config = NULL;