diff options
author | David S. Miller <davem@davemloft.net> | 2009-08-12 20:37:52 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-08-12 20:37:52 -0400 |
commit | 9799218ae36910af50f002a5db1802d576fffb43 (patch) | |
tree | e7b7ee627852bc1cb038c14fef8a4ac38f5b8875 /drivers | |
parent | e9d126cdfa60b575f1b5b02024c4faee27dccf07 (diff) |
Revert "libertas: Read buffer overflow"
This reverts commit 57921c312e8cef72ba35a4cfe870b376da0b1b87.
On request from John Linville:
It has been shown to create a new problem. There is work
towards a solution to that one, but it isn't a simple
clean-up.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/libertas/assoc.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/drivers/net/wireless/libertas/assoc.c b/drivers/net/wireless/libertas/assoc.c index d6997371c27e..b9b374119033 100644 --- a/drivers/net/wireless/libertas/assoc.c +++ b/drivers/net/wireless/libertas/assoc.c | |||
@@ -1,7 +1,6 @@ | |||
1 | /* Copyright (C) 2006, Red Hat, Inc. */ | 1 | /* Copyright (C) 2006, Red Hat, Inc. */ |
2 | 2 | ||
3 | #include <linux/types.h> | 3 | #include <linux/types.h> |
4 | #include <linux/kernel.h> | ||
5 | #include <linux/etherdevice.h> | 4 | #include <linux/etherdevice.h> |
6 | #include <linux/ieee80211.h> | 5 | #include <linux/ieee80211.h> |
7 | #include <linux/if_arp.h> | 6 | #include <linux/if_arp.h> |
@@ -44,21 +43,21 @@ static int get_common_rates(struct lbs_private *priv, | |||
44 | u16 *rates_size) | 43 | u16 *rates_size) |
45 | { | 44 | { |
46 | u8 *card_rates = lbs_bg_rates; | 45 | u8 *card_rates = lbs_bg_rates; |
46 | size_t num_card_rates = sizeof(lbs_bg_rates); | ||
47 | int ret = 0, i, j; | 47 | int ret = 0, i, j; |
48 | u8 tmp[(ARRAY_SIZE(lbs_bg_rates) - 1) * (*rates_size - 1)]; | 48 | u8 tmp[30]; |
49 | size_t tmp_size = 0; | 49 | size_t tmp_size = 0; |
50 | 50 | ||
51 | /* For each rate in card_rates that exists in rate1, copy to tmp */ | 51 | /* For each rate in card_rates that exists in rate1, copy to tmp */ |
52 | for (i = 0; i < ARRAY_SIZE(lbs_bg_rates) && card_rates[i]; i++) { | 52 | for (i = 0; card_rates[i] && (i < num_card_rates); i++) { |
53 | for (j = 0; j < *rates_size && rates[j]; j++) { | 53 | for (j = 0; rates[j] && (j < *rates_size); j++) { |
54 | if (rates[j] == card_rates[i]) | 54 | if (rates[j] == card_rates[i]) |
55 | tmp[tmp_size++] = card_rates[i]; | 55 | tmp[tmp_size++] = card_rates[i]; |
56 | } | 56 | } |
57 | } | 57 | } |
58 | 58 | ||
59 | lbs_deb_hex(LBS_DEB_JOIN, "AP rates ", rates, *rates_size); | 59 | lbs_deb_hex(LBS_DEB_JOIN, "AP rates ", rates, *rates_size); |
60 | lbs_deb_hex(LBS_DEB_JOIN, "card rates ", card_rates, | 60 | lbs_deb_hex(LBS_DEB_JOIN, "card rates ", card_rates, num_card_rates); |
61 | ARRAY_SIZE(lbs_bg_rates)); | ||
62 | lbs_deb_hex(LBS_DEB_JOIN, "common rates", tmp, tmp_size); | 61 | lbs_deb_hex(LBS_DEB_JOIN, "common rates", tmp, tmp_size); |
63 | lbs_deb_join("TX data rate 0x%02x\n", priv->cur_rate); | 62 | lbs_deb_join("TX data rate 0x%02x\n", priv->cur_rate); |
64 | 63 | ||
@@ -70,7 +69,10 @@ static int get_common_rates(struct lbs_private *priv, | |||
70 | lbs_pr_alert("Previously set fixed data rate %#x isn't " | 69 | lbs_pr_alert("Previously set fixed data rate %#x isn't " |
71 | "compatible with the network.\n", priv->cur_rate); | 70 | "compatible with the network.\n", priv->cur_rate); |
72 | ret = -1; | 71 | ret = -1; |
72 | goto done; | ||
73 | } | 73 | } |
74 | ret = 0; | ||
75 | |||
74 | done: | 76 | done: |
75 | memset(rates, 0, *rates_size); | 77 | memset(rates, 0, *rates_size); |
76 | *rates_size = min_t(int, tmp_size, *rates_size); | 78 | *rates_size = min_t(int, tmp_size, *rates_size); |
@@ -320,7 +322,7 @@ static int lbs_associate(struct lbs_private *priv, | |||
320 | rates = (struct mrvl_ie_rates_param_set *) pos; | 322 | rates = (struct mrvl_ie_rates_param_set *) pos; |
321 | rates->header.type = cpu_to_le16(TLV_TYPE_RATES); | 323 | rates->header.type = cpu_to_le16(TLV_TYPE_RATES); |
322 | memcpy(&rates->rates, &bss->rates, MAX_RATES); | 324 | memcpy(&rates->rates, &bss->rates, MAX_RATES); |
323 | tmplen = min_t(u16, ARRAY_SIZE(rates->rates), MAX_RATES); | 325 | tmplen = MAX_RATES; |
324 | if (get_common_rates(priv, rates->rates, &tmplen)) { | 326 | if (get_common_rates(priv, rates->rates, &tmplen)) { |
325 | ret = -1; | 327 | ret = -1; |
326 | goto done; | 328 | goto done; |
@@ -596,7 +598,7 @@ static int lbs_adhoc_join(struct lbs_private *priv, | |||
596 | 598 | ||
597 | /* Copy Data rates from the rates recorded in scan response */ | 599 | /* Copy Data rates from the rates recorded in scan response */ |
598 | memset(cmd.bss.rates, 0, sizeof(cmd.bss.rates)); | 600 | memset(cmd.bss.rates, 0, sizeof(cmd.bss.rates)); |
599 | ratesize = min_t(u16, ARRAY_SIZE(cmd.bss.rates), MAX_RATES); | 601 | ratesize = min_t(u16, sizeof(cmd.bss.rates), MAX_RATES); |
600 | memcpy(cmd.bss.rates, bss->rates, ratesize); | 602 | memcpy(cmd.bss.rates, bss->rates, ratesize); |
601 | if (get_common_rates(priv, cmd.bss.rates, &ratesize)) { | 603 | if (get_common_rates(priv, cmd.bss.rates, &ratesize)) { |
602 | lbs_deb_join("ADHOC_JOIN: get_common_rates returned error.\n"); | 604 | lbs_deb_join("ADHOC_JOIN: get_common_rates returned error.\n"); |