Skip to content

Commit

Permalink
nl80211: fix validation of scheduled scan info for wowlan netdetect
Browse files Browse the repository at this point in the history
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: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
Reviewed-by: Franky Lin <franky.lin@broadcom.com>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  • Loading branch information
Arend Van Spriel authored and Johannes Berg committed Feb 8, 2017
1 parent 66cd794 commit aad1e81
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions net/wireless/nl80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -6912,7 +6912,7 @@ nl80211_parse_sched_scan_plans(struct wiphy *wiphy, int n_plans,

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;
Expand Down Expand Up @@ -6977,7 +6977,7 @@ nl80211_parse_sched_scan(struct wiphy *wiphy, struct wireless_dev *wdev,
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])
Expand Down Expand Up @@ -7277,7 +7277,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)
Expand Down Expand Up @@ -10089,7 +10090,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;
Expand Down

0 comments on commit aad1e81

Please sign in to comment.