Skip to content

Commit

Permalink
rt2x00: Block set_key() during suspend/shutdown
Browse files Browse the repository at this point in the history
mac80211 will call set_key() when the device is
shutting down. When the device is unplugged the
keys will be lost automatically due to the power
loss. When the device is not plugged but the module
is only unloaded the keys can remain in the device
hardware, when the module is loaded the keys will
be cleaned up during initialization.

This should prevent the problem reported by Johannes Berg,
where unplugging the device while suspended resulted in
a NULL pointer error during set_key() which was
caused because of the CSR base address being freed.

Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Ivo van Doorn authored and John W. Linville committed Nov 21, 2008
1 parent 9a95dba commit 8058409
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/net/wireless/rt2x00/rt2x00mac.c
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,9 @@ int rt2x00mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
struct ieee80211_key_conf *key);
struct rt2x00lib_crypto crypto;

if (!test_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags))
if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags))
return 0;
else if (!test_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags))
return -EOPNOTSUPP;
else if (key->keylen > 32)
return -ENOSPC;
Expand Down

0 comments on commit 8058409

Please sign in to comment.