* [patch] ath9k_htc: memory corruption calling set_bit()
@ 2015-05-14 8:34 Dan Carpenter
2015-05-26 10:54 ` Kalle Valo
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2015-05-14 8:34 UTC (permalink / raw)
To: QCA ath9k Development, Sujith Manoharan
Cc: Kalle Valo, linux-wireless, ath9k-devel, kernel-janitors,
Joe Perches
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>
---
OP_TSF_RESET seems to be a write-only bit. Maybe we should just delete
it?
diff --git a/drivers/net/wireless/ath/ath9k/htc.h b/drivers/net/wireless/ath/ath9k/htc.h
index e82a0d4..5dbc617 100644
--- a/drivers/net/wireless/ath/ath9k/htc.h
+++ b/drivers/net/wireless/ath/ath9k/htc.h
@@ -440,9 +440,9 @@ static inline void ath9k_htc_stop_btcoex(struct ath9k_htc_priv *priv)
}
#endif /* CONFIG_ATH9K_BTCOEX_SUPPORT */
-#define OP_BT_PRIORITY_DETECTED BIT(3)
-#define OP_BT_SCAN BIT(4)
-#define OP_TSF_RESET BIT(6)
+#define OP_BT_PRIORITY_DETECTED 3
+#define OP_BT_SCAN 4
+#define OP_TSF_RESET 6
enum htc_op_flags {
HTC_FWFLAG_NO_RMW,
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: ath9k_htc: memory corruption calling set_bit()
2015-05-14 8:34 [patch] ath9k_htc: memory corruption calling set_bit() Dan Carpenter
@ 2015-05-26 10:54 ` Kalle Valo
0 siblings, 0 replies; 2+ messages in thread
From: Kalle Valo @ 2015-05-26 10:54 UTC (permalink / raw)
To: Dan Carpenter
Cc: QCA ath9k Development, Sujith Manoharan, linux-wireless,
ath9k-devel, kernel-janitors, Joe Perches
> 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>
Thanks, applied to wireless-drivers-next.git.
Kalle Valo
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-05-26 13:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-14 8:34 [patch] ath9k_htc: memory corruption calling set_bit() Dan Carpenter
2015-05-26 10:54 ` Kalle Valo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).