rt2x00: fix memory corruption in rf cache, add a sanity check
commit97fbdb9896762c050f9791518383c04242ec243c
authorPavel Roskin <proski@gnu.org>
Tue, 4 Aug 2009 21:48:16 +0000 (4 17:48 -0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 9 Sep 2009 03:33:18 +0000 (8 20:33 -0700)
tree974ada24757064ae66a00ea5416234d3def584e3
parent687b51397caa23be0f3c82733e35aa03429b5894
rt2x00: fix memory corruption in rf cache, add a sanity check

commit 6b26dead3ce97d016b57724b01974d5ca5c84bd5 upstream.

Change rt2x00_rf_read() and rt2x00_rf_write() to subtract 1 from the rf
register number.  This is needed because the rf registers are enumerated
starting with one.  The size of the rf register cache is just enough to
hold all registers, so writing to the highest register was corrupting
memory.  Add a check to make sure that the rf register number is valid.

Signed-off-by: Pavel Roskin <proski@gnu.org>
Acked-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/net/wireless/rt2x00/rt2x00.h