[patch 065/108] cfg80211: return immediately if num reg rules > NL80211_MAX_SUPP_REG_RULES

Greg KH
2009-07-01T01:04:56Z

[-- Attachment #1: cfg80211-return-immediately-if-num-reg-rules-nl80211_max_supp_reg_rules.patch --]
[-- Type: text/plain, Size: 932 bytes --]

2.6.30-stable review patch. If anyone has any objections, please let us know.

------------------

From: Luis R. Rodriguez <lrodriguez@atheros.com>

commit 4776c6e7f66f853011bc1fd6fe37fa63f0b6982c upstream.

This has no functional change except we save a kfree(rd) and
allows us to clean this code up a bit after this. We do
avoid an unnecessary kfree(NULL) but calling that was OK too.

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>

---
net/wireless/nl80211.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -2385,7 +2385,7 @@ static int nl80211_set_reg(struct sk_buf
rem_reg_rules) {
num_rules++;
if (num_rules > NL80211_MAX_SUPP_REG_RULES)
- goto bad_reg;
+ return -EINVAL;
}

if (!reg_is_valid_request(alpha2)) {