From: Bob Copeland <me@bobcopeland.com>
To: linville@tuxdriver.com, jirislaby@gmail.com, mickflemm@gmail.com,
lrodriguez@atheros.com
Cc: linux-wireless@vger.kernel.org, ath5k-devel@lists.ath5k.org,
Bob Copeland <me@bobcopeland.com>
Subject: [PATCH 5/5] ath5k: manipulate rxlink and descriptor address under rxbuf lock
Date: Wed, 15 Apr 2009 07:57:36 -0400 [thread overview]
Message-ID: <1239796656-20646-6-git-send-email-me@bobcopeland.com> (raw)
In-Reply-To: <1239796656-20646-1-git-send-email-me@bobcopeland.com>
Grabbing an ath5k_buf then dropping the lock is racy because the
referenced descriptor can be obtained in another thread and released
before the buffer is handed to the hardware. Likewise, manipulating
sc->rxlink without the lock can lead to having multiple self-linked
hardware descriptors.
Changes-licensed-under: 3-Clause-BSD
Signed-off-by: Bob Copeland <me@bobcopeland.com>
---
drivers/net/wireless/ath/ath5k/base.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
index 1a6e72f..c8c658b 100644
--- a/drivers/net/wireless/ath/ath5k/base.c
+++ b/drivers/net/wireless/ath/ath5k/base.c
@@ -1618,9 +1618,8 @@ ath5k_rx_start(struct ath5k_softc *sc)
ATH5K_DBG(sc, ATH5K_DEBUG_RESET, "cachelsz %u rxbufsize %u\n",
sc->cachelsz, sc->rxbufsize);
- sc->rxlink = NULL;
-
spin_lock_bh(&sc->rxbuflock);
+ sc->rxlink = NULL;
list_for_each_entry(bf, &sc->rxbuf, list) {
ret = ath5k_rxbuf_setup(sc, bf);
if (ret != 0) {
@@ -1629,9 +1628,9 @@ ath5k_rx_start(struct ath5k_softc *sc)
}
}
bf = list_first_entry(&sc->rxbuf, struct ath5k_buf, list);
+ ath5k_hw_set_rxdp(ah, bf->daddr);
spin_unlock_bh(&sc->rxbuflock);
- ath5k_hw_set_rxdp(ah, bf->daddr);
ath5k_hw_start_rx_dma(ah); /* enable recv descriptors */
ath5k_mode_setup(sc); /* set filters, etc. */
ath5k_hw_start_rx_pcu(ah); /* re-enable PCU/DMA engine */
--
1.6.0.6
next prev parent reply other threads:[~2009-04-15 11:58 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-15 11:57 [PATCH 0/5] misc ath5k fixes Bob Copeland
2009-04-15 11:57 ` [PATCH 1/5] ath5k: fix initvals errors Bob Copeland
2009-04-15 12:09 ` Nick Kossifidis
2009-04-15 11:57 ` [PATCH 2/5] ath5k: use tasklet_hi_schedule for beacon queue Bob Copeland
2009-04-15 12:11 ` Nick Kossifidis
2009-04-15 11:57 ` [PATCH 3/5] ath5k: use bool for modparams Bob Copeland
2009-04-15 12:11 ` Nick Kossifidis
2009-04-15 11:57 ` [PATCH 4/5] ath5k: use rx hw descriptor pointer for self-linked check Bob Copeland
2009-04-15 12:12 ` Nick Kossifidis
2009-04-15 12:20 ` [ath5k-devel] " Daniel J Blueman
2009-04-15 12:35 ` Bob Copeland
2009-04-15 11:57 ` Bob Copeland [this message]
2009-04-15 12:13 ` [PATCH 5/5] ath5k: manipulate rxlink and descriptor address under rxbuf lock Nick Kossifidis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1239796656-20646-6-git-send-email-me@bobcopeland.com \
--to=me@bobcopeland.com \
--cc=ath5k-devel@lists.ath5k.org \
--cc=jirislaby@gmail.com \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=lrodriguez@atheros.com \
--cc=mickflemm@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox