diff options
author | Stanislaw Gruszka <sgruszka@redhat.com> | 2010-02-02 09:34:50 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-02-02 16:03:41 -0500 |
commit | f09c256375c7cf1e112b8ef6306cdd313490d7c0 (patch) | |
tree | 1f888356fb5c0b2ee13b8a5d14990719eeb3c398 /drivers | |
parent | 299af9d3db0fd3a4994e5e66717ecd276bdd60da (diff) |
airo: fix setting zero length WEP key
Patch prevents call set_wep_key() with zero key length. That fix long
standing regression since commit c0380693520b1a1e4f756799a0edc379378b462a
"airo: clean up WEP key operations". Additionally print call trace when
someone will try to use improper parameters, and remove key.len = 0
assignment, because it is in not possible code path.
Reported-by: Chris Siebenmann <cks-rhbugzilla@cs.toronto.edu>
Bisected-by: Chris Siebenmann <cks-rhbugzilla@cs.toronto.edu>
Tested-by: Chris Siebenmann <cks@cs.toronto.edu>
Cc: Dan Williams <dcbw@redhat.com>
Cc: <stable@kernel.org>
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/airo.c | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c index 4331d675fcc6..2a9f029a3c74 100644 --- a/drivers/net/wireless/airo.c +++ b/drivers/net/wireless/airo.c | |||
@@ -5254,11 +5254,7 @@ static int set_wep_key(struct airo_info *ai, u16 index, const char *key, | |||
5254 | WepKeyRid wkr; | 5254 | WepKeyRid wkr; |
5255 | int rc; | 5255 | int rc; |
5256 | 5256 | ||
5257 | if (keylen == 0) { | 5257 | WARN_ON(keylen == 0); |
5258 | airo_print_err(ai->dev->name, "%s: key length to set was zero", | ||
5259 | __func__); | ||
5260 | return -1; | ||
5261 | } | ||
5262 | 5258 | ||
5263 | memset(&wkr, 0, sizeof(wkr)); | 5259 | memset(&wkr, 0, sizeof(wkr)); |
5264 | wkr.len = cpu_to_le16(sizeof(wkr)); | 5260 | wkr.len = cpu_to_le16(sizeof(wkr)); |
@@ -6405,11 +6401,7 @@ static int airo_set_encode(struct net_device *dev, | |||
6405 | if (dwrq->length > MIN_KEY_SIZE) | 6401 | if (dwrq->length > MIN_KEY_SIZE) |
6406 | key.len = MAX_KEY_SIZE; | 6402 | key.len = MAX_KEY_SIZE; |
6407 | else | 6403 | else |
6408 | if (dwrq->length > 0) | 6404 | key.len = MIN_KEY_SIZE; |
6409 | key.len = MIN_KEY_SIZE; | ||
6410 | else | ||
6411 | /* Disable the key */ | ||
6412 | key.len = 0; | ||
6413 | /* Check if the key is not marked as invalid */ | 6405 | /* Check if the key is not marked as invalid */ |
6414 | if(!(dwrq->flags & IW_ENCODE_NOKEY)) { | 6406 | if(!(dwrq->flags & IW_ENCODE_NOKEY)) { |
6415 | /* Cleanup */ | 6407 | /* Cleanup */ |
@@ -6590,12 +6582,22 @@ static int airo_set_encodeext(struct net_device *dev, | |||
6590 | default: | 6582 | default: |
6591 | return -EINVAL; | 6583 | return -EINVAL; |
6592 | } | 6584 | } |
6593 | /* Send the key to the card */ | 6585 | if (key.len == 0) { |
6594 | rc = set_wep_key(local, idx, key.key, key.len, perm, 1); | 6586 | rc = set_wep_tx_idx(local, idx, perm, 1); |
6595 | if (rc < 0) { | 6587 | if (rc < 0) { |
6596 | airo_print_err(local->dev->name, "failed to set WEP key" | 6588 | airo_print_err(local->dev->name, |
6597 | " at index %d: %d.", idx, rc); | 6589 | "failed to set WEP transmit index to %d: %d.", |
6598 | return rc; | 6590 | idx, rc); |
6591 | return rc; | ||
6592 | } | ||
6593 | } else { | ||
6594 | rc = set_wep_key(local, idx, key.key, key.len, perm, 1); | ||
6595 | if (rc < 0) { | ||
6596 | airo_print_err(local->dev->name, | ||
6597 | "failed to set WEP key at index %d: %d.", | ||
6598 | idx, rc); | ||
6599 | return rc; | ||
6600 | } | ||
6599 | } | 6601 | } |
6600 | } | 6602 | } |
6601 | 6603 | ||