Commit d0e18f83 authored by Luis R. Rodriguez's avatar Luis R. Rodriguez Committed by John W. Linville

cfg80211: cleanup return calls on nl80211_set_reg()

This has no functional change, but it will make the race
fix easier to spot in my next patch.

Cc: stable@kernel.org
Signed-off-by: default avatarLuis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 4776c6e7
...@@ -2570,15 +2570,19 @@ static int nl80211_set_reg(struct sk_buff *skb, struct genl_info *info) ...@@ -2570,15 +2570,19 @@ static int nl80211_set_reg(struct sk_buff *skb, struct genl_info *info)
return -EINVAL; return -EINVAL;
} }
if (!reg_is_valid_request(alpha2)) if (!reg_is_valid_request(alpha2)) {
return -EINVAL; r = -EINVAL;
goto bad_reg;
}
size_of_regd = sizeof(struct ieee80211_regdomain) + size_of_regd = sizeof(struct ieee80211_regdomain) +
(num_rules * sizeof(struct ieee80211_reg_rule)); (num_rules * sizeof(struct ieee80211_reg_rule));
rd = kzalloc(size_of_regd, GFP_KERNEL); rd = kzalloc(size_of_regd, GFP_KERNEL);
if (!rd) if (!rd) {
return -ENOMEM; r = -ENOMEM;
goto bad_reg;
}
rd->n_reg_rules = num_rules; rd->n_reg_rules = num_rules;
rd->alpha2[0] = alpha2[0]; rd->alpha2[0] = alpha2[0];
...@@ -2595,20 +2599,23 @@ static int nl80211_set_reg(struct sk_buff *skb, struct genl_info *info) ...@@ -2595,20 +2599,23 @@ static int nl80211_set_reg(struct sk_buff *skb, struct genl_info *info)
rule_idx++; rule_idx++;
if (rule_idx > NL80211_MAX_SUPP_REG_RULES) if (rule_idx > NL80211_MAX_SUPP_REG_RULES) {
r = -EINVAL;
goto bad_reg; goto bad_reg;
} }
}
BUG_ON(rule_idx != num_rules); BUG_ON(rule_idx != num_rules);
mutex_lock(&cfg80211_mutex); mutex_lock(&cfg80211_mutex);
r = set_regdom(rd); r = set_regdom(rd);
mutex_unlock(&cfg80211_mutex); mutex_unlock(&cfg80211_mutex);
return r; return r;
bad_reg: bad_reg:
kfree(rd); kfree(rd);
return -EINVAL; return r;
} }
static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info) static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info)
......
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