diff options
author | Adam Baker <linux@baker-net.org.uk> | 2007-10-27 07:43:29 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 18:03:03 -0500 |
commit | 3d82346c5d0ff0a413c387c6edaadc0ca29a0971 (patch) | |
tree | 790b3fcc6ccee693d9ac343626d1296c736a7851 /drivers/net/wireless/rt2x00/rt2x00.h | |
parent | 4bd7c452a468af30bb3c4d9c3adcdaf3f3c6048c (diff) |
rt2x00: Place mutex around USB register access
There is a buffer, csr_cache which is used to hold copies of data being passed
to the USB stack which can get corrupted if multiple threads attempt to access
CSR registers simultaneously. There is also the possibility if multiple
threads try to access BBP or RF registers for the multiple USB operations
needed to get interleaved leading to incorrect results. This patch introduces
a mutex to prevent such simultaneous access. The interleaved access problem
may also affect the PCI devices but if so that will be handled in a follow-up
patch.
Signed-off-by: Adam Baker <linux@baker-net.org.uk>
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2x00.h')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h index 2cd2c9fab1a5..75c9a766e421 100644 --- a/drivers/net/wireless/rt2x00/rt2x00.h +++ b/drivers/net/wireless/rt2x00/rt2x00.h | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/skbuff.h> | 31 | #include <linux/skbuff.h> |
32 | #include <linux/workqueue.h> | 32 | #include <linux/workqueue.h> |
33 | #include <linux/firmware.h> | 33 | #include <linux/firmware.h> |
34 | #include <linux/mutex.h> | ||
34 | 35 | ||
35 | #include <net/mac80211.h> | 36 | #include <net/mac80211.h> |
36 | 37 | ||
@@ -659,6 +660,18 @@ struct rt2x00_dev { | |||
659 | void *csr_cache; | 660 | void *csr_cache; |
660 | 661 | ||
661 | /* | 662 | /* |
663 | * Mutex to protect register accesses on USB devices. | ||
664 | * There are 2 reasons this is needed, one is to ensure | ||
665 | * use of the csr_cache (for USB devices) by one thread | ||
666 | * isn't corrupted by another thread trying to access it. | ||
667 | * The other is that access to BBP and RF registers | ||
668 | * require multiple BUS transactions and if another thread | ||
669 | * attempted to access one of those registers at the same | ||
670 | * time one of the writes could silently fail. | ||
671 | */ | ||
672 | struct mutex usb_cache_mutex; | ||
673 | |||
674 | /* | ||
662 | * Interface configuration. | 675 | * Interface configuration. |
663 | */ | 676 | */ |
664 | struct interface interface; | 677 | struct interface interface; |