public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Brian King <brking@linux.vnet.ibm.com>
To: unlisted-recipients:; (no To-header on input)
Cc: brking@pobox.com, jeffrey.t.kirsher@intel.com,
	intel-wired-lan@lists.osuosl.org, stable@vger.kernel.org,
	maurosr@linux.vnet.ibm.com,
	Brian King <brking@linux.vnet.ibm.com>
Subject: [PATCH 1/7] ixgbe: Fix skb list corruption on Power systems
Date: Thu, 16 Nov 2017 09:37:49 -0600	[thread overview]
Message-ID: <1510846675-15169-2-git-send-email-brking@linux.vnet.ibm.com> (raw)
In-Reply-To: <1510846675-15169-1-git-send-email-brking@linux.vnet.ibm.com>

This patch fixes an issue seen on Power systems with ixgbe which results
in skb list corruption and an eventual kernel oops. The following is what
was observed:

CPU 1                                   CPU2
============================            ============================
1: ixgbe_xmit_frame_ring                ixgbe_clean_tx_irq
2:  first->skb = skb                     eop_desc = tx_buffer->next_to_watch
3:  ixgbe_tx_map                         read_barrier_depends()
4:   wmb                                 check adapter written status bit
5:   first->next_to_watch = tx_desc      napi_consume_skb(tx_buffer->skb ..);
6:   writel(i, tx_ring->tail);

The read_barrier_depends is insufficient to ensure that tx_buffer->skb does not
get loaded prior to tx_buffer->next_to_watch, which then results in loading
a stale skb pointer, since we aren't zeroing it, like is done in other
similar code in other networking drivers. This patch addresses both of these
issues, replacing the read_barrier_depends with an smp_rmb, which will ensure
the load of tx_buffer->skb will not occur until after the load from
tx_buffer->next_to_watch. Secondly, it zeroes tx_buffer->skb to make this
consistent with other Intel ethernet drivers and elso ensure we don't leave
a stale skb pointer sitting around.

Cc: stable<stable@vger.kernel.org>
Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 6d5f31e..4d8c7bb 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -1192,7 +1192,7 @@ static bool ixgbe_clean_tx_irq(struct ixgbe_q_vector *q_vector,
 			break;
 
 		/* prevent any other reads prior to eop_desc */
-		read_barrier_depends();
+		smp_rmb();
 
 		/* if DD is not set pending work has not been completed */
 		if (!(eop_desc->wb.status & cpu_to_le32(IXGBE_TXD_STAT_DD)))
@@ -1218,6 +1218,7 @@ static bool ixgbe_clean_tx_irq(struct ixgbe_q_vector *q_vector,
 				 DMA_TO_DEVICE);
 
 		/* clear tx_buffer data */
+		tx_buffer->skb = NULL;
 		dma_unmap_len_set(tx_buffer, len, 0);
 
 		/* unmap remaining buffers */
-- 
1.8.3.1

  reply	other threads:[~2017-11-16 15:38 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-16 15:37 [PATCH 0/7] [RESEND] [net] intel: Use smp_rmb rather than read_barrier_depends Brian King
2017-11-16 15:37 ` Brian King [this message]
2017-11-16 15:37 ` [PATCH 2/7] i40e: " Brian King
2017-11-16 15:37 ` [PATCH 3/7] ixgbevf: " Brian King
2017-11-16 15:37 ` [PATCH 4/7] igbvf: " Brian King
2017-11-16 15:37 ` [PATCH 5/7] igb: " Brian King
2017-11-16 15:37 ` [PATCH 6/7] fm10k: " Brian King
2017-11-16 15:37 ` [PATCH 7/7] i40evf: " Brian King
2017-11-16 19:33 ` [Intel-wired-lan] [PATCH 0/7] [RESEND] [net] intel: " Jesse Brandeburg
2017-11-16 20:03   ` Brian King
2017-11-16 21:09     ` Duyck, Alexander H
2017-11-16 22:01     ` Jesse Brandeburg
2017-11-16 22:57     ` Michael Ellerman
2017-11-17 16:16       ` Brian King
2017-11-17 16:50         ` Duyck, Alexander H

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=1510846675-15169-2-git-send-email-brking@linux.vnet.ibm.com \
    --to=brking@linux.vnet.ibm.com \
    --cc=brking@pobox.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=jeffrey.t.kirsher@intel.com \
    --cc=maurosr@linux.vnet.ibm.com \
    --cc=stable@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox