summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorLuis R. Rodriguez <lrodriguez@atheros.com>2009-05-13 17:04:40 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2009-07-02 16:50:08 -0700
commit2596f0a38069879ad4aec95a8f932075054ad6ba (patch)
treeaf55456d6acc6ec710660259b3c75382d0c7de20 /net
parenteebd7ca1029a0d253bbc94544ca887fdb05d0b55 (diff)
cfg80211: cleanup return calls on nl80211_set_reg()
commit d0e18f833d23afefb6751a21d14a2cd71d2d4d66 upstream. This has no functional change, but it will make the race fix easier to spot in my next patch. Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'net')
-rw-r--r--net/wireless/nl80211.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 2456e4ee445e..f1a30def64d4 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -2388,15 +2388,19 @@ static int nl80211_set_reg(struct sk_buff *skb, struct genl_info *info)
goto bad_reg;
}
- if (!reg_is_valid_request(alpha2))
- return -EINVAL;
+ if (!reg_is_valid_request(alpha2)) {
+ r = -EINVAL;
+ goto bad_reg;
+ }
size_of_regd = sizeof(struct ieee80211_regdomain) +
(num_rules * sizeof(struct ieee80211_reg_rule));
rd = kzalloc(size_of_regd, GFP_KERNEL);
- if (!rd)
- return -ENOMEM;
+ if (!rd) {
+ r = -ENOMEM;
+ goto bad_reg;
+ }
rd->n_reg_rules = num_rules;
rd->alpha2[0] = alpha2[0];
@@ -2413,8 +2417,10 @@ static int nl80211_set_reg(struct sk_buff *skb, struct genl_info *info)
rule_idx++;
- if (rule_idx > NL80211_MAX_SUPP_REG_RULES)
+ if (rule_idx > NL80211_MAX_SUPP_REG_RULES) {
+ r = -EINVAL;
goto bad_reg;
+ }
}
BUG_ON(rule_idx != num_rules);
@@ -2422,11 +2428,12 @@ static int nl80211_set_reg(struct sk_buff *skb, struct genl_info *info)
mutex_lock(&cfg80211_mutex);
r = set_regdom(rd);
mutex_unlock(&cfg80211_mutex);
+
return r;
bad_reg:
kfree(rd);
- return -EINVAL;
+ return r;
}
static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info)