linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stanislaw Gruszka <sgruszka@redhat.com>
To: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Cc: linville@tuxdriver.com, linux-wireless@vger.kernel.org,
	Meenakshi Venkataraman <meenakshi.venkataraman@intel.com>,
	stable@vger.kernel.org
Subject: Re: [PATCH 3.4] iwlwifi: fix a potential race in receive buffer allocation
Date: Tue, 8 May 2012 16:05:56 +0200	[thread overview]
Message-ID: <20120508140555.GA4412@redhat.com> (raw)
In-Reply-To: <1336079364-16222-1-git-send-email-wey-yi.w.guy@intel.com>

On Thu, May 03, 2012 at 02:09:24PM -0700, Wey-Yi Guy wrote:
> From: Meenakshi Venkataraman <meenakshi.venkataraman@intel.com>
> 
> The driver can potentially unmap pages that
> have not been mapped yet. Fix this race
> condition.
> 
> Cc: stable@vger.kernel.org
> Reported-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
> Signed-off-by: Meenakshi Venkataraman <meenakshi.venkataraman@intel.com>
> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
> ---
> this patch will be also available from wireless branch on
>  git://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/iwlwifi.git
> 
>  drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c
> index aa7aea1..173275f 100644
> --- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c
> +++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c
> @@ -310,7 +310,6 @@ static void iwlagn_rx_allocate(struct iwl_trans *trans, gfp_t priority)
>  		spin_unlock_irqrestore(&rxq->lock, flags);
>  
>  		BUG_ON(rxb->page);
> -		rxb->page = page;
>  		/* Get physical address of the RB */
>  		rxb->page_dma = dma_map_page(trans->dev, page, 0,
>  				PAGE_SIZE << hw_params(trans).rx_page_order,
> @@ -320,6 +319,9 @@ static void iwlagn_rx_allocate(struct iwl_trans *trans, gfp_t priority)
>  		/* and also 256 byte aligned! */
>  		BUG_ON(rxb->page_dma & DMA_BIT_MASK(8));
>  
> +		/* Page *must* be mapped before before updating the rxb. */
> +		rxb->page = page;
> +
>  		spin_lock_irqsave(&rxq->lock, flags);
>  
>  		list_add_tail(&rxb->list, &rxq->rx_free);

This patch make no sense. Nothing stops compiler or CPU to write
->page into memory before ->page_dma .

Stanislaw

  reply	other threads:[~2012-05-08 14:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-03 21:09 [PATCH 3.4] iwlwifi: fix a potential race in receive buffer allocation Wey-Yi Guy
2012-05-08 14:05 ` Stanislaw Gruszka [this message]
2012-05-08 17:00   ` Emmanuel Grumbach
2012-05-08 18:34     ` Venkataraman, Meenakshi
2012-05-09  7:53     ` Stanislaw Gruszka

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=20120508140555.GA4412@redhat.com \
    --to=sgruszka@redhat.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=meenakshi.venkataraman@intel.com \
    --cc=stable@vger.kernel.org \
    --cc=wey-yi.w.guy@intel.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;
as well as URLs for NNTP newsgroup(s).