diff options
author | Luis R. Rodriguez <lrodriguez@atheros.com> | 2009-05-13 17:04:40 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-05-20 14:46:31 -0400 |
commit | d0e18f833d23afefb6751a21d14a2cd71d2d4d66 (patch) | |
tree | 7a4b2772388f08d96f224f12568fd001dd25798e /net/wireless | |
parent | 4776c6e7f66f853011bc1fd6fe37fa63f0b6982c (diff) |
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: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/wireless')
-rw-r--r-- | net/wireless/nl80211.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 52a877998ff7..66e0fb6a6420 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -2570,15 +2570,19 @@ static int nl80211_set_reg(struct sk_buff *skb, struct genl_info *info) | |||
2570 | return -EINVAL; | 2570 | return -EINVAL; |
2571 | } | 2571 | } |
2572 | 2572 | ||
2573 | if (!reg_is_valid_request(alpha2)) | 2573 | if (!reg_is_valid_request(alpha2)) { |
2574 | return -EINVAL; | 2574 | r = -EINVAL; |
2575 | goto bad_reg; | ||
2576 | } | ||
2575 | 2577 | ||
2576 | size_of_regd = sizeof(struct ieee80211_regdomain) + | 2578 | size_of_regd = sizeof(struct ieee80211_regdomain) + |
2577 | (num_rules * sizeof(struct ieee80211_reg_rule)); | 2579 | (num_rules * sizeof(struct ieee80211_reg_rule)); |
2578 | 2580 | ||
2579 | rd = kzalloc(size_of_regd, GFP_KERNEL); | 2581 | rd = kzalloc(size_of_regd, GFP_KERNEL); |
2580 | if (!rd) | 2582 | if (!rd) { |
2581 | return -ENOMEM; | 2583 | r = -ENOMEM; |
2584 | goto bad_reg; | ||
2585 | } | ||
2582 | 2586 | ||
2583 | rd->n_reg_rules = num_rules; | 2587 | rd->n_reg_rules = num_rules; |
2584 | rd->alpha2[0] = alpha2[0]; | 2588 | rd->alpha2[0] = alpha2[0]; |
@@ -2595,8 +2599,10 @@ static int nl80211_set_reg(struct sk_buff *skb, struct genl_info *info) | |||
2595 | 2599 | ||
2596 | rule_idx++; | 2600 | rule_idx++; |
2597 | 2601 | ||
2598 | if (rule_idx > NL80211_MAX_SUPP_REG_RULES) | 2602 | if (rule_idx > NL80211_MAX_SUPP_REG_RULES) { |
2603 | r = -EINVAL; | ||
2599 | goto bad_reg; | 2604 | goto bad_reg; |
2605 | } | ||
2600 | } | 2606 | } |
2601 | 2607 | ||
2602 | BUG_ON(rule_idx != num_rules); | 2608 | BUG_ON(rule_idx != num_rules); |
@@ -2604,11 +2610,12 @@ static int nl80211_set_reg(struct sk_buff *skb, struct genl_info *info) | |||
2604 | mutex_lock(&cfg80211_mutex); | 2610 | mutex_lock(&cfg80211_mutex); |
2605 | r = set_regdom(rd); | 2611 | r = set_regdom(rd); |
2606 | mutex_unlock(&cfg80211_mutex); | 2612 | mutex_unlock(&cfg80211_mutex); |
2613 | |||
2607 | return r; | 2614 | return r; |
2608 | 2615 | ||
2609 | bad_reg: | 2616 | bad_reg: |
2610 | kfree(rd); | 2617 | kfree(rd); |
2611 | return -EINVAL; | 2618 | return r; |
2612 | } | 2619 | } |
2613 | 2620 | ||
2614 | static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info) | 2621 | static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info) |