Skip to content

Commit 772f038

Browse files
ilanpeer2jmberg-intel
authored andcommitted
cfg80211: fix few minor issues in reg_process_hint()
Fix the following issues in reg_process_hint(): 1. Add verification that wiphy is valid before processing NL80211_REGDOMAIN_SET_BY_COUNTRY_IE. 2. Free the request in case of invalid initiator. 3. Remove WARN_ON check on reg_request->alpha2 as it is not a pointer. Signed-off-by: Ilan Peer <ilan.peer@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent 5251207 commit 772f038

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

‎net/wireless/reg.c‎

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1683,17 +1683,9 @@ static void reg_process_hint(struct regulatory_request *reg_request)
16831683
struct wiphy *wiphy = NULL;
16841684
enum reg_request_treatment treatment;
16851685

1686-
if (WARN_ON(!reg_request->alpha2))
1687-
return;
1688-
16891686
if (reg_request->wiphy_idx != WIPHY_IDX_INVALID)
16901687
wiphy = wiphy_idx_to_wiphy(reg_request->wiphy_idx);
16911688

1692-
if (reg_request->initiator == NL80211_REGDOM_SET_BY_DRIVER && !wiphy) {
1693-
kfree(reg_request);
1694-
return;
1695-
}
1696-
16971689
switch (reg_request->initiator) {
16981690
case NL80211_REGDOM_SET_BY_CORE:
16991691
reg_process_hint_core(reg_request);
@@ -1706,20 +1698,29 @@ static void reg_process_hint(struct regulatory_request *reg_request)
17061698
schedule_delayed_work(&reg_timeout, msecs_to_jiffies(3142));
17071699
return;
17081700
case NL80211_REGDOM_SET_BY_DRIVER:
1701+
if (!wiphy)
1702+
goto out_free;
17091703
treatment = reg_process_hint_driver(wiphy, reg_request);
17101704
break;
17111705
case NL80211_REGDOM_SET_BY_COUNTRY_IE:
1706+
if (!wiphy)
1707+
goto out_free;
17121708
treatment = reg_process_hint_country_ie(wiphy, reg_request);
17131709
break;
17141710
default:
17151711
WARN(1, "invalid initiator %d\n", reg_request->initiator);
1716-
return;
1712+
goto out_free;
17171713
}
17181714

17191715
/* This is required so that the orig_* parameters are saved */
17201716
if (treatment == REG_REQ_ALREADY_SET && wiphy &&
17211717
wiphy->regulatory_flags & REGULATORY_STRICT_REG)
17221718
wiphy_update_regulatory(wiphy, reg_request->initiator);
1719+
1720+
return;
1721+
1722+
out_free:
1723+
kfree(reg_request);
17231724
}
17241725

17251726
/*

0 commit comments

Comments
 (0)