Commit e5f5ce37 authored by Johannes Berg's avatar Johannes Berg

mac80211: validate user rate mask before configuring driver

Ben reported that when the user rate mask is rejected for not
matching any basic rate, the driver had already been configured.
This is clearly an oversight in my original change, fix this by
doing the validation before calling the driver.
Reported-by: default avatarBen Greear <greearb@candelatech.com>
Fixes: e8e4f528 ("mac80211: reject/clear user rate mask if not usable")
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 51e13359
...@@ -2727,12 +2727,6 @@ static int ieee80211_set_bitrate_mask(struct wiphy *wiphy, ...@@ -2727,12 +2727,6 @@ static int ieee80211_set_bitrate_mask(struct wiphy *wiphy,
if (!ieee80211_sdata_running(sdata)) if (!ieee80211_sdata_running(sdata))
return -ENETDOWN; return -ENETDOWN;
if (ieee80211_hw_check(&local->hw, HAS_RATE_CONTROL)) {
ret = drv_set_bitrate_mask(local, sdata, mask);
if (ret)
return ret;
}
/* /*
* If active validate the setting and reject it if it doesn't leave * If active validate the setting and reject it if it doesn't leave
* at least one basic rate usable, since we really have to be able * at least one basic rate usable, since we really have to be able
...@@ -2748,6 +2742,12 @@ static int ieee80211_set_bitrate_mask(struct wiphy *wiphy, ...@@ -2748,6 +2742,12 @@ static int ieee80211_set_bitrate_mask(struct wiphy *wiphy,
return -EINVAL; return -EINVAL;
} }
if (ieee80211_hw_check(&local->hw, HAS_RATE_CONTROL)) {
ret = drv_set_bitrate_mask(local, sdata, mask);
if (ret)
return ret;
}
for (i = 0; i < NUM_NL80211_BANDS; i++) { for (i = 0; i < NUM_NL80211_BANDS; i++) {
struct ieee80211_supported_band *sband = wiphy->bands[i]; struct ieee80211_supported_band *sband = wiphy->bands[i];
int j; int j;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment