LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Iyappan Subramanian <isubramanian@apm.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, mlangsdo@redhat.com,
	patches@apm.com, Keyur Chudgar <kchudgar@apm.com>
Subject: Re: [PATCH] drivers: net: xgene: fix: Out of order descriptor bytes read
Date: Thu, 22 Jan 2015 14:50:50 -0800	[thread overview]
Message-ID: <1421967050.3471.14.camel@edumazet-glaptop2.roam.corp.google.com> (raw)
In-Reply-To: <1421957007-720-1-git-send-email-isubramanian@apm.com>

On Thu, 2015-01-22 at 12:03 -0800, Iyappan Subramanian wrote:
> This patch fixes the following kernel crash,
> 
> 	WARNING: CPU: 2 PID: 0 at net/ipv4/tcp_input.c:3079 tcp_clean_rtx_queue+0x658/0x80c()
> 	Call trace:

> 
> Software writes poison data into the descriptor bytes[15:8] and upon
> receiving the interrupt, if those bytes are overwritten by the hardware with
> the valid data, software also reads bytes[7:0] and executes receive/tx
> completion logic.
> 
> If the CPU executes the above two reads in out of order fashion, then the
> bytes[7:0] will have older data and causing the kernel panic.  We have to
> force the order of the reads and thus this patch introduces read memory
> barrier between these reads.
> 
> Signed-off-by: Iyappan Subramanian <isubramanian@apm.com>
> Signed-off-by: Keyur Chudgar <kchudgar@apm.com>
> Tested-by: Mark Langsdorf <mlangsdo@redhat.com>
> ---
>  drivers/net/ethernet/apm/xgene/xgene_enet_main.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
> index 83a5028..3622cdb 100644
> --- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
> +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
> @@ -369,6 +369,8 @@ static int xgene_enet_process_ring(struct xgene_enet_desc_ring *ring,
>  		if (unlikely(xgene_enet_is_desc_slot_empty(raw_desc)))
>  			break;
>  
> +		/* read fpqnum field after dataaddr field */
> +		smp_rmb();
>  		if (is_rx_desc(raw_desc))
>  			ret = xgene_enet_rx_frame(ring, raw_desc);
>  		else

Reading your changelog, it looks like you need a plain rmb() here.




  reply	other threads:[~2015-01-22 22:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-22 20:03 Iyappan Subramanian
2015-01-22 22:50 ` Eric Dumazet [this message]
2015-01-26 21:12   ` Iyappan Subramanian
2015-01-26 21:27     ` Eric Dumazet
2015-01-26 21:32       ` Eric Dumazet
2015-01-26 22:34     ` David Miller

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=1421967050.3471.14.camel@edumazet-glaptop2.roam.corp.google.com \
    --to=eric.dumazet@gmail.com \
    --cc=davem@davemloft.net \
    --cc=isubramanian@apm.com \
    --cc=kchudgar@apm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mlangsdo@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=patches@apm.com \
    --subject='Re: [PATCH] drivers: net: xgene: fix: Out of order descriptor bytes read' \
    /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

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).