2009-01-22 13:44:35

by Bob Copeland

[permalink] [raw]
Subject: [PATCH 1/6] ath5k: fix locking in ath5k_config

ath5k_config updates the software context without taking sc->lock.

Changes-licensed-under: 3-Clause-BSD

Signed-off-by: Bob Copeland <[email protected]>
---
drivers/net/wireless/ath5k/base.c | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/ath5k/base.c b/drivers/net/wireless/ath5k/base.c
index 747b496..1e1222c 100644
--- a/drivers/net/wireless/ath5k/base.c
+++ b/drivers/net/wireless/ath5k/base.c
@@ -1021,6 +1021,8 @@ ath5k_setup_bands(struct ieee80211_hw *hw)
* it's done by reseting the chip. To accomplish this we must
* first cleanup any pending DMA, then restart stuff after a la
* ath5k_init.
+ *
+ * Called with sc->lock.
*/
static int
ath5k_chan_set(struct ath5k_softc *sc, struct ieee80211_channel *chan)
@@ -2825,11 +2827,17 @@ ath5k_config(struct ieee80211_hw *hw, u32 changed)
{
struct ath5k_softc *sc = hw->priv;
struct ieee80211_conf *conf = &hw->conf;
+ int ret;
+
+ mutex_lock(&sc->lock);

sc->bintval = conf->beacon_int;
sc->power_level = conf->power_level;

- return ath5k_chan_set(sc, conf->channel);
+ ret = ath5k_chan_set(sc, conf->channel);
+
+ mutex_unlock(&sc->lock);
+ return ret;
}

static int
--
1.6.0.6




2009-01-22 17:41:28

by Nick Kossifidis

[permalink] [raw]
Subject: Re: [PATCH 1/6] ath5k: fix locking in ath5k_config

2009/1/22 Bob Copeland <[email protected]>:
> ath5k_config updates the software context without taking sc->lock.
>
> Changes-licensed-under: 3-Clause-BSD
>
> Signed-off-by: Bob Copeland <[email protected]>
> ---
> drivers/net/wireless/ath5k/base.c | 10 +++++++++-
> 1 files changed, 9 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/net/wireless/ath5k/base.c b/drivers/net/wireless/ath5k/base.c
> index 747b496..1e1222c 100644
> --- a/drivers/net/wireless/ath5k/base.c
> +++ b/drivers/net/wireless/ath5k/base.c
> @@ -1021,6 +1021,8 @@ ath5k_setup_bands(struct ieee80211_hw *hw)
> * it's done by reseting the chip. To accomplish this we must
> * first cleanup any pending DMA, then restart stuff after a la
> * ath5k_init.
> + *
> + * Called with sc->lock.
> */
> static int
> ath5k_chan_set(struct ath5k_softc *sc, struct ieee80211_channel *chan)
> @@ -2825,11 +2827,17 @@ ath5k_config(struct ieee80211_hw *hw, u32 changed)
> {
> struct ath5k_softc *sc = hw->priv;
> struct ieee80211_conf *conf = &hw->conf;
> + int ret;
> +
> + mutex_lock(&sc->lock);
>
> sc->bintval = conf->beacon_int;
> sc->power_level = conf->power_level;
>
> - return ath5k_chan_set(sc, conf->channel);
> + ret = ath5k_chan_set(sc, conf->channel);
> +
> + mutex_unlock(&sc->lock);
> + return ret;
> }
>
> static int

Acked-by: Nick Kossifidis <[email protected]>


--
GPG ID: 0xD21DB2DB
As you read this post global entropy rises. Have Fun ;-)
Nick