ath9k: fix key allocation error handling for powersave keys
authorFelix Fietkau <nbd@openwrt.org>
Sat, 27 Apr 2013 09:47:01 +0000 (11:47 +0200)
committerBen Hutchings <ben@decadent.org.uk>
Thu, 30 May 2013 13:34:50 +0000 (14:34 +0100)
commit8e590dc654420b9aa0172b6a3ff64a7675927672
tree932616816a50cbeb6db1742fe85d01e94183cc4d
parenta71745129b6be9de9cca1b716df15f5ce817d49e
ath9k: fix key allocation error handling for powersave keys

commit 4ef69d0394cba8caa9f75d3f2e53429bfb8b3045 upstream.

If no keycache slots are available, ath_key_config can return -ENOSPC.
If the key index is not checked for errors, it can lead to logspam that
looks like this: "ath: wiphy0: keyreset: keycache entry 228 out of range"
This can cause follow-up errors if the invalid keycache index gets
used for tx.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/net/wireless/ath/ath9k/main.c