All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vaishali Thakkar <vaishali.thakkar@oracle.com>
To: Pavel Andrianov <andrianov@ispras.ru>, Kalle Valo <kvalo@codeaurora.org>
Cc: libertas-dev@lists.infradead.org, linux-wireless@vger.kernel.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	ldv-project@linuxtesting.org
Subject: Re: [PATCH] libertas: Add spinlock to avoid race condition
Date: Wed, 15 Jun 2016 18:31:39 +0530	[thread overview]
Message-ID: <576151B3.9040802@oracle.com> (raw)
In-Reply-To: <1465990443-19738-1-git-send-email-andrianov@ispras.ru>



On Wednesday 15 June 2016 05:04 PM, Pavel Andrianov wrote:
> lbs_mac_event_disconnected may free priv->currenttxskb
> while lbs_hard_start_xmit accesses to it.
> The patch adds a spinlock for mutual exclusion.
> 
> Tested on OLPC XO-1 (usb8388) and XO-1.5 (sd8686) with v4.7-rc3.
> 
> Confirmed that lbs_mac_event_disconnected is being called on the
> station when hostapd on access point is given SIGHUP.
> 
> Signed-off-by: Pavel <andrianov@ispras.ru>
> Tested-by: James Cameron <quozl@laptop.org>

Looks good to me.

Acked-by: Vaishali Thakkar <vaishali.thakkar@oracle.com>

> ---
>  drivers/net/wireless/marvell/libertas/cmdresp.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/net/wireless/marvell/libertas/cmdresp.c b/drivers/net/wireless/marvell/libertas/cmdresp.c
> index c95bf6d..c67ae07 100644
> --- a/drivers/net/wireless/marvell/libertas/cmdresp.c
> +++ b/drivers/net/wireless/marvell/libertas/cmdresp.c
> @@ -27,6 +27,8 @@
>  void lbs_mac_event_disconnected(struct lbs_private *priv,
>  				bool locally_generated)
>  {
> +	unsigned long flags;
> +
>  	if (priv->connect_status != LBS_CONNECTED)
>  		return;
>  
> @@ -46,9 +48,11 @@ void lbs_mac_event_disconnected(struct lbs_private *priv,
>  	netif_carrier_off(priv->dev);
>  
>  	/* Free Tx and Rx packets */
> +	spin_lock_irqsave(&priv->driver_lock, flags);
>  	kfree_skb(priv->currenttxskb);
>  	priv->currenttxskb = NULL;
>  	priv->tx_pending_len = 0;
> +	spin_unlock_irqrestore(&priv->driver_lock, flags);
>  
>  	priv->connect_status = LBS_DISCONNECTED;
>  
> 

-- 
Vaishali

  reply	other threads:[~2016-06-15 13:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-15 11:34 [PATCH] libertas: Add spinlock to avoid race condition Pavel Andrianov
2016-06-15 13:01 ` Vaishali Thakkar [this message]
2016-06-29 15:47 ` Kalle Valo

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=576151B3.9040802@oracle.com \
    --to=vaishali.thakkar@oracle.com \
    --cc=andrianov@ispras.ru \
    --cc=kvalo@codeaurora.org \
    --cc=ldv-project@linuxtesting.org \
    --cc=libertas-dev@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.