aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorLennert Buytenhek <buytenh@wantstofly.org>2009-11-30 12:14:23 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-12-07 16:51:23 -0500
commit16cec43da50c4b4702653ca710549fd3457a4e6c (patch)
treee94a8291b1b3cd71659e3fd4ed1825b30ae17837 /drivers/net
parentd1844d77692de3158ad458ed4c7b86d78ab4085e (diff)
mwl8k: don't complain about oversized beacons in FINALIZE_JOIN
The FINALIZE_JOIN firmware command only looks at the first couple of fields in the beacon, and therefore it's not necessary to complain if the beacon is longer than 128 bytes. Signed-off-by: Lennert Buytenhek <buytenh@marvell.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/mwl8k.c29
1 files changed, 8 insertions, 21 deletions
diff --git a/drivers/net/wireless/mwl8k.c b/drivers/net/wireless/mwl8k.c
index ea1173fd598c..59d49159cf2a 100644
--- a/drivers/net/wireless/mwl8k.c
+++ b/drivers/net/wireless/mwl8k.c
@@ -2469,8 +2469,6 @@ mwl8k_set_edca_params(struct ieee80211_hw *hw, __u8 qnum,
2469/* 2469/*
2470 * CMD_FINALIZE_JOIN. 2470 * CMD_FINALIZE_JOIN.
2471 */ 2471 */
2472
2473/* FJ beacon buffer size is compiled into the firmware. */
2474#define MWL8K_FJ_BEACON_MAXLEN 128 2472#define MWL8K_FJ_BEACON_MAXLEN 128
2475 2473
2476struct mwl8k_cmd_finalize_join { 2474struct mwl8k_cmd_finalize_join {
@@ -2480,17 +2478,13 @@ struct mwl8k_cmd_finalize_join {
2480} __attribute__((packed)); 2478} __attribute__((packed));
2481 2479
2482static int mwl8k_finalize_join(struct ieee80211_hw *hw, void *frame, 2480static int mwl8k_finalize_join(struct ieee80211_hw *hw, void *frame,
2483 __u16 framelen, __u16 dtim) 2481 int framelen, int dtim)
2484{ 2482{
2485 struct mwl8k_cmd_finalize_join *cmd; 2483 struct mwl8k_cmd_finalize_join *cmd;
2486 struct ieee80211_mgmt *payload = frame; 2484 struct ieee80211_mgmt *payload = frame;
2487 u16 hdrlen; 2485 int payload_len;
2488 u32 payload_len;
2489 int rc; 2486 int rc;
2490 2487
2491 if (frame == NULL)
2492 return -EINVAL;
2493
2494 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); 2488 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
2495 if (cmd == NULL) 2489 if (cmd == NULL)
2496 return -ENOMEM; 2490 return -ENOMEM;
@@ -2499,24 +2493,17 @@ static int mwl8k_finalize_join(struct ieee80211_hw *hw, void *frame,
2499 cmd->header.length = cpu_to_le16(sizeof(*cmd)); 2493 cmd->header.length = cpu_to_le16(sizeof(*cmd));
2500 cmd->sleep_interval = cpu_to_le32(dtim ? dtim : 1); 2494 cmd->sleep_interval = cpu_to_le32(dtim ? dtim : 1);
2501 2495
2502 hdrlen = ieee80211_hdrlen(payload->frame_control); 2496 payload_len = framelen - ieee80211_hdrlen(payload->frame_control);
2503 2497 if (payload_len < 0)
2504 payload_len = framelen > hdrlen ? framelen - hdrlen : 0; 2498 payload_len = 0;
2505 2499 else if (payload_len > MWL8K_FJ_BEACON_MAXLEN)
2506 /* XXX TBD Might just have to abort and return an error */
2507 if (payload_len > MWL8K_FJ_BEACON_MAXLEN)
2508 printk(KERN_ERR "%s(): WARNING: Incomplete beacon "
2509 "sent to firmware. Sz=%u MAX=%u\n", __func__,
2510 payload_len, MWL8K_FJ_BEACON_MAXLEN);
2511
2512 if (payload_len > MWL8K_FJ_BEACON_MAXLEN)
2513 payload_len = MWL8K_FJ_BEACON_MAXLEN; 2500 payload_len = MWL8K_FJ_BEACON_MAXLEN;
2514 2501
2515 if (payload && payload_len) 2502 memcpy(cmd->beacon_data, &payload->u.beacon, payload_len);
2516 memcpy(cmd->beacon_data, &payload->u.beacon, payload_len);
2517 2503
2518 rc = mwl8k_post_cmd(hw, &cmd->header); 2504 rc = mwl8k_post_cmd(hw, &cmd->header);
2519 kfree(cmd); 2505 kfree(cmd);
2506
2520 return rc; 2507 return rc;
2521} 2508}
2522 2509