diff mbox

[RFT] iwlegacy: don't mess up the SCD when removing a key

Message ID 1341148023-17673-1-git-send-email-emmanuel.grumbach@intel.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Emmanuel Grumbach July 1, 2012, 1:07 p.m. UTC
When we remove a key, we put a key index which was supposed
to tell the fw that we are actually removing the key. But
instead the fw took that index as a valid index and messed
up the SRAM of the device.

This memory corruption on the device mangled the data of
the SCD. The impact on the user is that SCD queue 2 got
stuck after having removed keys.

Cc: Paul Bolle <pebolle@tiscali.nl>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
---
Paul, can you please test ?
If it solve the issues for you, I will send as a patch and Cc stable
Totally not tested
---

 drivers/net/wireless/iwlegacy/4965-mac.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Comments

Paul Bolle July 1, 2012, 12:01 p.m. UTC | #1
Emmanuel,

On Sun, 2012-07-01 at 16:07 +0300, Emmanuel Grumbach wrote:
> Paul, can you please test ?

Sure, and thanks for porting that patch.

> If it solve the issues for you, I will send as a patch and Cc stable
> Totally not tested

Note that it might take some days, maybe even a week, before I can be
confident that the patch works. Perhaps I should give suspending and
resuming in a loop a try, that should speed up testing.


Paul Bolle

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Emmanuel Grumbach July 1, 2012, 1:29 p.m. UTC | #2
> 

> Emmanuel,

> 

> On Sun, 2012-07-01 at 16:07 +0300, Emmanuel Grumbach wrote:

> > Paul, can you please test ?

> 

> Sure, and thanks for porting that patch.

> 

> > If it solve the issues for you, I will send as a patch and Cc stable

> > Totally not tested

> 

> Note that it might take some days, maybe even a week, before I can be

> confident that the patch works. Perhaps I should give suspending and

> resuming in a loop a try, that should speed up testing.

> 


You can also try to simply associate / disassociate in a loop with and without my patch. This was the scenario that was fixed by my patch in iwlwifi.
---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
Paul Bolle July 1, 2012, 1:36 p.m. UTC | #3
Emmanuel,

On Sun, 2012-07-01 at 13:29 +0000, Grumbach, Emmanuel wrote:
> You can also try to simply associate / disassociate in a loop with and
> without my patch. This was the scenario that was fixed by my patch in
> iwlwifi.

I'm actually unfamiliar with associating and disassociating. How can I
do that in a loop?


Paul Bolle

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Emmanuel Grumbach July 1, 2012, 1:47 p.m. UTC | #4
DQo+IEVtbWFudWVsLA0KPiANCj4gT24gU3VuLCAyMDEyLTA3LTAxIGF0IDEzOjI5ICswMDAwLCBH
cnVtYmFjaCwgRW1tYW51ZWwgd3JvdGU6DQo+ID4gWW91IGNhbiBhbHNvIHRyeSB0byBzaW1wbHkg
YXNzb2NpYXRlIC8gZGlzYXNzb2NpYXRlIGluIGEgbG9vcCB3aXRoIGFuZA0KPiA+IHdpdGhvdXQg
bXkgcGF0Y2guIFRoaXMgd2FzIHRoZSBzY2VuYXJpbyB0aGF0IHdhcyBmaXhlZCBieSBteSBwYXRj
aCBpbg0KPiA+IGl3bHdpZmkuDQo+IA0KPiBJJ20gYWN0dWFsbHkgdW5mYW1pbGlhciB3aXRoIGFz
c29jaWF0aW5nIGFuZCBkaXNhc3NvY2lhdGluZy4gSG93IGNhbiBJIGRvIHRoYXQgaW4NCj4gYSBs
b29wPw0KPiANCg0KSSBndWVzcyB5b3UgaGF2ZSBhIHNlY3VyZWQgcHJvZmlsZSByaWdodD8gSWYg
eW91IGRvbid0LCBteSBwYXRjaCBpcyBpcnJlbGV2YW50Lg0KSnVzdCBjbGljayBvbiBkaXNjb25u
ZWN0IGluIHlvdXIgR1VJLCBJIGd1ZXNzIGl0IHNob3VsZCBtYWtlIGl0Lg0KDQpZb3UgY2FuIGFs
c28gZG86DQoNCndwYV9jbGkgZGlzY29ubmVjdA0Kd3BhX2NsaSByZWNvbm5lY3QNCg0Kb3Igc29t
ZXRoaW5nIGxpa2UgdGhhdC4NCi0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t
LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQpJbnRlbCBJc3JhZWwgKDc0KSBMaW1pdGVk
CgpUaGlzIGUtbWFpbCBhbmQgYW55IGF0dGFjaG1lbnRzIG1heSBjb250YWluIGNvbmZpZGVudGlh
bCBtYXRlcmlhbCBmb3IKdGhlIHNvbGUgdXNlIG9mIHRoZSBpbnRlbmRlZCByZWNpcGllbnQocyku
IEFueSByZXZpZXcgb3IgZGlzdHJpYnV0aW9uCmJ5IG90aGVycyBpcyBzdHJpY3RseSBwcm9oaWJp
dGVkLiBJZiB5b3UgYXJlIG5vdCB0aGUgaW50ZW5kZWQKcmVjaXBpZW50LCBwbGVhc2UgY29udGFj
dCB0aGUgc2VuZGVyIGFuZCBkZWxldGUgYWxsIGNvcGllcy4K

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Stanislaw Gruszka July 2, 2012, 8:26 a.m. UTC | #5
On Sun, Jul 01, 2012 at 04:07:03PM +0300, Emmanuel Grumbach wrote:
> diff --git a/drivers/net/wireless/iwlegacy/4965-mac.c b/drivers/net/wireless/iwlegacy/4965-mac.c
> index d24eaf8..9981f09 100644
> --- a/drivers/net/wireless/iwlegacy/4965-mac.c
> +++ b/drivers/net/wireless/iwlegacy/4965-mac.c
> @@ -3420,7 +3420,7 @@ il4965_remove_dynamic_key(struct il_priv *il,
>  	memset(&il->stations[sta_id].sta.key, 0, sizeof(struct il4965_keyinfo));
>  	il->stations[sta_id].sta.key.key_flags =
>  	    STA_KEY_FLG_NO_ENC | STA_KEY_FLG_INVALID;
> -	il->stations[sta_id].sta.key.key_offset = WEP_INVALID_OFFSET;
> +	il->stations[sta_id].sta.key.key_offset = keyconf->hw_key_idx;

Thanks for the patch. Just small issue with it. We use key_offset to
check if the key is invalid on the below code:

        if (il->stations[sta_id].sta.key.key_offset == WEP_INVALID_OFFSET) {
                IL_WARN("Removing wrong key %d 0x%x\n", keyconf->keyidx,
                        key_flags);
                spin_unlock_irqrestore(&il->sta_lock, flags);
                return 0;
        }

Since you changed the key_offset, above check should be changed as well,
probably using STA_KEY_FLG_INVALID flag.

Stanislaw 
 
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/wireless/iwlegacy/4965-mac.c b/drivers/net/wireless/iwlegacy/4965-mac.c
index d24eaf8..9981f09 100644
--- a/drivers/net/wireless/iwlegacy/4965-mac.c
+++ b/drivers/net/wireless/iwlegacy/4965-mac.c
@@ -3420,7 +3420,7 @@  il4965_remove_dynamic_key(struct il_priv *il,
 	memset(&il->stations[sta_id].sta.key, 0, sizeof(struct il4965_keyinfo));
 	il->stations[sta_id].sta.key.key_flags =
 	    STA_KEY_FLG_NO_ENC | STA_KEY_FLG_INVALID;
-	il->stations[sta_id].sta.key.key_offset = WEP_INVALID_OFFSET;
+	il->stations[sta_id].sta.key.key_offset = keyconf->hw_key_idx;
 	il->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK;
 	il->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;