From: "Guy, Wey-Yi" <wey-yi.w.guy@intel.com>
To: Stanislaw Gruszka <sgruszka@redhat.com>
Cc: "Chatre, Reinette" <reinette.chatre@intel.com>,
"John W. Linville" <linville@tuxdriver.com>,
"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
"stable@kernel.org" <stable@kernel.org>
Subject: Re: [PATCH] iwlwifi: fix scan abort
Date: Thu, 29 Jul 2010 06:53:14 -0700 [thread overview]
Message-ID: <1280411594.24402.1.camel@wwguy-ubuntu> (raw)
In-Reply-To: <20100729113741.152e986a@dhcp-lab-109.englab.brq.redhat.com>
On Thu, 2010-07-29 at 02:37 -0700, Stanislaw Gruszka wrote:
> Fix possible double priv->mutex lock introduced by commit
> a69b03e941abae00380fc6bc1877fb797a1b31e6
> "iwlwifi: cancel scan watchdog in iwl_bg_abort_scan" .
> We can not call cancel_delayed_work_sync(&priv->scan_check) with
> priv->mutex locked because workqueue function iwl_bg_scan_check()
> take that lock internally.
>
> We do not need to synchronize when canceling priv->scan_check work.
> We can avoid races (sending double abort command or send no
> command at all) using STATUS_SCAN_ABORT bit. Moreover
> current iwl_bg_scan_check() code seems to be broken, as
> we should not send abort commands when currently aborting.
>
> Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
> CC: stable@kernel.org
>
> diff --git a/drivers/net/wireless/iwlwifi/iwl-scan.c b/drivers/net/wireless/iwlwifi/iwl-scan.c
> index 2a7c399..b0c6b04 100644
> --- a/drivers/net/wireless/iwlwifi/iwl-scan.c
> +++ b/drivers/net/wireless/iwlwifi/iwl-scan.c
> @@ -429,11 +429,10 @@ void iwl_bg_scan_check(struct work_struct *data)
> return;
>
> mutex_lock(&priv->mutex);
> - if (test_bit(STATUS_SCANNING, &priv->status) ||
> - test_bit(STATUS_SCAN_ABORTING, &priv->status)) {
> - IWL_DEBUG_SCAN(priv, "Scan completion watchdog resetting "
> - "adapter (%dms)\n",
> - jiffies_to_msecs(IWL_SCAN_CHECK_WATCHDOG));
> + if (test_bit(STATUS_SCANNING, &priv->status) &&
> + !test_bit(STATUS_SCAN_ABORTING, &priv->status)) {
> + IWL_DEBUG_SCAN(priv, "Scan completion watchdog (%dms)\n",
> + jiffies_to_msecs(IWL_SCAN_CHECK_WATCHDOG));
>
> if (!test_bit(STATUS_EXIT_PENDING, &priv->status))
> iwl_send_scan_abort(priv);
> @@ -498,12 +497,11 @@ void iwl_bg_abort_scan(struct work_struct *work)
> !test_bit(STATUS_GEO_CONFIGURED, &priv->status))
> return;
>
> - mutex_lock(&priv->mutex);
> -
> - cancel_delayed_work_sync(&priv->scan_check);
> - set_bit(STATUS_SCAN_ABORTING, &priv->status);
> - iwl_send_scan_abort(priv);
> + cancel_delayed_work(&priv->scan_check);
>
> + mutex_lock(&priv->mutex);
> + if (test_bit(STATUS_SCAN_ABORTING, &priv->status))
> + iwl_send_scan_abort(priv);
> mutex_unlock(&priv->mutex);
> }
> EXPORT_SYMBOL(iwl_bg_abort_scan);
looks good and thanks
Wey
prev parent reply other threads:[~2010-07-29 13:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-29 9:37 [PATCH] iwlwifi: fix scan abort Stanislaw Gruszka
2010-07-29 13:53 ` Guy, Wey-Yi [this message]
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=1280411594.24402.1.camel@wwguy-ubuntu \
--to=wey-yi.w.guy@intel.com \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=reinette.chatre@intel.com \
--cc=sgruszka@redhat.com \
--cc=stable@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox