ath9k_htc: memory corruption calling set_bit()
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 14 May 2015 08:34:48 +0000 (11:34 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 3 Aug 2015 16:28:58 +0000 (09:28 -0700)
commit01fe812522c67852943800c724199836a66d3a52
treeb5faa55f6f36bde4e94664f0087c91086ef5a604
parentf3a16a0597a773deb7ee578c3453e62cc1f9e222
ath9k_htc: memory corruption calling set_bit()

commit 191f1aeeb93bb58e56f4d1868294ae22f3f67d4e upstream.

In d8a2c51cdcae ('ath9k_htc: Use atomic operations for op_flags') we
changed things like this:

- if (priv->op_flags & OP_TSF_RESET) {
+ if (test_bit(OP_TSF_RESET, &priv->op_flags)) {

The problem is that test_bit() takes a bit number and not a mask.  It
means that when we do:

set_bit(OP_TSF_RESET, &priv->op_flags);

Then it sets the (1 << 6) bit instead of the 6 bit so we are setting a
bit which is past the end of the unsigned long.

Fixes: d8a2c51cdcae ('ath9k_htc: Use atomic operations for op_flags')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/wireless/ath/ath9k/htc.h