[JAUNTY] UBUNTU: SAUCE: Added patch to ath5k driver: protect reset sequence by a spinlock

Tim Gardner tim.gardner at canonical.com
Thu Apr 30 18:49:29 UTC 2009


Manoj Iyer wrote:
> SRU JUSTIFICATION:
> 
> IMPACT: ath5k driver hangs periodically
> FIX: protect reset sequence by a spinlock
> TEST: Both amd64 and i386 kernels in 
> http://people.ubuntu.com/~manjo/lp356768-jaunty/
> were tested.
> 
> The following changes since commit 
> a63b7d7beeaa1f8f33369cab6419831fa8991e40:
>    Tyler Hicks (1):
>          UBUNTU: SAUCE: (drop after 2.6.28) [PATCH] eCryptfs: Larger buffer 
> for encrypted symlink targets
> 
> are available in the git repository at:
> 
>    git://kernel.ubuntu.com/manjo/ubuntu-jaunty.git lp356768
> 
> Manoj Iyer (1):
>        UBUNTU: SAUCE: Added patch to ath5k driver: protect reset sequence 
> by a spinlock
> 
>   drivers/net/wireless/ath5k/base.c |    6 ++++++
>   drivers/net/wireless/ath5k/base.h |    1 +
>   drivers/net/wireless/ath5k/phy.c  |    2 +-
>   3 files changed, 8 insertions(+), 1 deletions(-)
> 
> 
> From 9f03cfed8629c1e8cef710cf6d0ddc972ba38768 Mon Sep 17 00:00:00 2001
> From: Manoj Iyer <manoj.iyer at canonical.com>
> Date: Wed, 22 Apr 2009 13:41:11 -0500
> Subject: [PATCH] UBUNTU: SAUCE: Added patch to ath5k driver: protect reset sequence by a spinlock
> 
> OriginalAuthor: Bob Copeland <me at bobcopeland.com>
> 
> Bug: #356768
> BugLink: https://bugs.launchpad.net/linux/+bug/356768
> 
> Signed-off-by: Manoj Iyer <manoj.iyer at canonical.com>
> ---
>   drivers/net/wireless/ath5k/base.c |    6 ++++++
>   drivers/net/wireless/ath5k/base.h |    1 +
>   drivers/net/wireless/ath5k/phy.c  |    2 +-
>   3 files changed, 8 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/net/wireless/ath5k/base.c b/drivers/net/wireless/ath5k/base.c
> index e521555..0f59b4d 100644
> --- a/drivers/net/wireless/ath5k/base.c
> +++ b/drivers/net/wireless/ath5k/base.c
> @@ -525,6 +525,7 @@ ath5k_pci_probe(struct pci_dev *pdev,
>   	sc->cachelsz = csz * sizeof(u32); /* convert to bytes */
>   	sc->opmode = NL80211_IFTYPE_STATION;
>   	mutex_init(&sc->lock);
> +	spin_lock_init(&sc->restlock);
>   	spin_lock_init(&sc->rxbuflock);
>   	spin_lock_init(&sc->txbuflock);
>   	spin_lock_init(&sc->block);
> @@ -2665,6 +2666,7 @@ ath5k_reset(struct ath5k_softc *sc, bool stop, bool change_channel)
>   {
>   	struct ath5k_hw *ah = sc->ah;
>   	int ret;
> +	unsigned long flags;
> 
>   	ATH5K_DBG(sc, ATH5K_DEBUG_RESET, "resetting\n");
> 
> @@ -2673,7 +2675,11 @@ ath5k_reset(struct ath5k_softc *sc, bool stop, bool change_channel)
>   		ath5k_txq_cleanup(sc);
>   		ath5k_rx_stop(sc);
>   	}
> +
> +	spin_lock_irqsave(&sc->restlock, flags);
>   	ret = ath5k_hw_reset(ah, sc->opmode, sc->curchan, true);
> +	spin_unlock_irqrestore(&sc->restlock, flags);
> +
>   	if (ret) {
>   		ATH5K_ERR(sc, "can't reset hardware (%d)\n", ret);
>   		goto err;
> diff --git a/drivers/net/wireless/ath5k/base.h b/drivers/net/wireless/ath5k/base.h
> index facc60d..bd08aae 100644
> --- a/drivers/net/wireless/ath5k/base.h
> +++ b/drivers/net/wireless/ath5k/base.h
> @@ -152,6 +152,7 @@ struct ath5k_softc {
>   				led_off;	/* off time for current blink */
> 
>   	struct tasklet_struct	restq;		/* reset tasklet */
> +	spinlock_t		restlock;	/* protects reset state */
> 
>   	unsigned int		rxbufsize;	/* rx size based on mtu */
>   	struct list_head	rxbuf;		/* receive buffer */
> diff --git a/drivers/net/wireless/ath5k/phy.c b/drivers/net/wireless/ath5k/phy.c
> index 35c7eb1..51e20d5 100644
> --- a/drivers/net/wireless/ath5k/phy.c
> +++ b/drivers/net/wireless/ath5k/phy.c
> @@ -1620,7 +1620,7 @@ int ath5k_hw_rfregs(struct ath5k_hw *ah, struct ieee80211_channel *channel,
> 
>   	if (ah->ah_rf_banks == NULL) {
>   		/* XXX do extra checks? */
> -		ah->ah_rf_banks = kmalloc(ah->ah_rf_banks_size, GFP_KERNEL);
> +		ah->ah_rf_banks = kmalloc(ah->ah_rf_banks_size, GFP_ATOMIC);
>   		if (ah->ah_rf_banks == NULL) {
>   			ATH5K_ERR(ah->ah_sc, "out of memory\n");
>   			return -ENOMEM;

This appears to be coming via stable updates. Shall we just wait and get
it for free? If you can intercept this commit from 2.6.28.y before
Stefan pulls from the stable tree, then just 'cherry-pick -x' it and add
the Bug number so you get LP changelog bot goodness.

rtg
-- 
Tim Gardner tim.gardner at canonical.com




More information about the kernel-team mailing list