Skip to contentSkip to conversation

Patch "e1000e: fix the use of magic numbers for buffer overrun issue" has been added to the 4.14-stable tree

PATCH [email protected] 1 participant 1 message Dec 4, 2017

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

e1000e: fix the use of magic numbers for buffer overrun issue

to the 4.14-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
e1000e-fix-the-use-of-magic-numbers-for-buffer-overrun-issue.patch
and it can be found in the queue-4.14 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From c0f4b163a03e73055dd734eaca64b9580e72e7fb Mon Sep 17 00:00:00 2001

From: Sasha Neftin <[email protected]>
Date: Mon, 6 Nov 2017 08:31:59 +0200
Subject: e1000e: fix the use of magic numbers for buffer overrun issue

From: Sasha Neftin <[email protected]>

commit c0f4b163a03e73055dd734eaca64b9580e72e7fb upstream.

This is a follow on to commit b10effb92e27 ("fix buffer overrun while the
I219 is processing DMA transactions") to address David Laights concerns
about the use of "magic" numbers. So define masks as well as add additional code comments to give a better understanding of what needs to be done to avoid a buffer overrun.

---
 drivers/net/ethernet/intel/e1000e/ich8lan.h |    3 ++-
 drivers/net/ethernet/intel/e1000e/netdev.c  |    9 ++++++---
 2 files changed, 8 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/e1000e/ich8lan.h +2 -1
@@ -113,7 +113,8 @@
 #define NVM_SIZE_MULTIPLIER 4096	/*multiplier for NVMS field */
 #define E1000_FLASH_BASE_ADDR 0xE000	/*offset of NVM access regs */
 #define E1000_CTRL_EXT_NVMVS 0x3	/*NVM valid sector */
-#define E1000_TARC0_CB_MULTIQ_3_REQ	(1 << 28 | 1 << 29)
+#define E1000_TARC0_CB_MULTIQ_3_REQ	0x30000000
+#define E1000_TARC0_CB_MULTIQ_2_REQ	0x20000000
 #define PCIE_ICH8_SNOOP_ALL	PCIE_NO_SNOOP_ALL
 
 #define E1000_ICH_RAR_ENTRIES	7
drivers/net/ethernet/intel/e1000e/netdev.c +6 -3
@@ -3030,9 +3030,12 @@ static void e1000_configure_tx(struct e1
 		ew32(IOSFPC, reg_val);
 
 		reg_val = er32(TARC(0));
-		/* SPT and KBL Si errata workaround to avoid Tx hang */
-		reg_val &= ~BIT(28);
-		reg_val |= BIT(29);
+		/* SPT and KBL Si errata workaround to avoid Tx hang.
+		 * Dropping the number of outstanding requests from
+		 * 3 to 2 in order to avoid a buffer overrun.
+		 */
+		reg_val &= ~E1000_TARC0_CB_MULTIQ_3_REQ;
+		reg_val |= E1000_TARC0_CB_MULTIQ_2_REQ;
 		ew32(TARC(0), reg_val);
 	}
 }

Patches currently in stable-queue which might be from [email protected] are

queue-4.14/e1000e-fix-the-use-of-magic-numbers-for-buffer-overrun-issue.patch