[patch for 2.6.27? 3/6] e1000: prevent corruption of EEPROM/NVM

Previous thread: [PATCH -mm] Fix dev_load() compilation again by Alexey Dobriyan on Friday, September 5, 2008 - 3:32 pm. (5 messages)

Next thread: [patch for 2.6.27? 1/6] drivers/net/skfp/pmf.c: Use offsetof() macro by akpm on Friday, September 5, 2008 - 5:04 pm. (2 messages)
To: <jeff@...>
Cc: <netdev@...>, <akpm@...>, <chrisl@...>, <arvidjaar@...>, <bruce.w.allan@...>, <jeffrey.t.kirsher@...>, <jesse.brandeburg@...>, <john.ronciak@...>, <peter.p.waskiewicz.jr@...>, <pratap@...>, <zach@...>
Date: Friday, September 5, 2008 - 5:04 pm

From: Christopher Li <chrisl@vmware.com>

Andrey reports e1000 corruption, and that a patch in vmware's ESX fixed
it.

The EEPROM corruption is triggered by concurrent access of the EEPROM
read/write. Putting a lock around it solve the problem.

[akpm@linux-foundation.org: use DEFINE_SPINLOCK to avoid confusing lockdep]
Signed-off-by: Christopher Li <chrisl@vmware.com>
Reported-by: Andrey Borzenkov <arvidjaar@mail.ru>
Cc: Zach Amsden <zach@vmware.com>
Cc: Pratap Subrahmanyam <pratap@vmware.com>
Cc: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Cc: Jesse Brandeburg <jesse.brandeburg@intel.com>
Cc: Bruce Allan <bruce.w.allan@intel.com>
Cc: PJ Waskiewicz <peter.p.waskiewicz.jr@intel.com>
Cc: John Ronciak <john.ronciak@intel.com>
Cc: Jeff Garzik <jeff@garzik.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

drivers/net/e1000/e1000_hw.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)

diff -puN drivers/net/e1000/e1000_hw.c~e1000e-prevent-corruption-of-eeprom-nvm drivers/net/e1000/e1000_hw.c
--- a/drivers/net/e1000/e1000_hw.c~e1000e-prevent-corruption-of-eeprom-nvm
+++ a/drivers/net/e1000/e1000_hw.c
@@ -144,6 +144,8 @@ static s32 e1000_host_if_read_cookie(str
static u8 e1000_calculate_mng_checksum(char *buffer, u32 length);
static s32 e1000_configure_kmrn_for_10_100(struct e1000_hw *hw, u16 duplex);
static s32 e1000_configure_kmrn_for_1000(struct e1000_hw *hw);
+static s32 e1000_do_read_eeprom(struct e1000_hw *hw, u16 offset, u16 words, u16 *data);
+static s32 e1000_do_write_eeprom(struct e1000_hw *hw, u16 offset, u16 words, u16 *data);

/* IGP cable length table */
static const
@@ -168,6 +170,8 @@ u16 e1000_igp_2_cable_length_table[IGP02
83, 89, 95, 100, 105, 109, 113, 116, 119, 122, 124,
104, 109, 114, 118, 121, 124};

+static DEFINE_SPINLOCK(e1000_eeprom_lock);
+
/******************************************************************************
* Se...

To: <akpm@...>
Cc: <netdev@...>, <chrisl@...>, <arvidjaar@...>, <bruce.w.allan@...>, <jeffrey.t.kirsher@...>, <jesse.brandeburg@...>, <john.ronciak@...>, <peter.p.waskiewicz.jr@...>, <pratap@...>, <zach@...>
Date: Thursday, September 18, 2008 - 9:41 pm

No further reply from Intel to my ping, and this regression needs to be
addressed, so, applied.

--

To: Jeff Garzik <jeff@...>, <akpm@...>
Cc: <netdev@...>, <chrisl@...>, <arvidjaar@...>, Allan, Bruce W <bruce.w.allan@...>, Kirsher, Jeffrey T <jeffrey.t.kirsher@...>, Ronciak, John <john.ronciak@...>, Waskiewicz Jr, Peter P <peter.p.waskiewicz.jr@...>, <pratap@...>, <zach@...>
Date: Friday, September 19, 2008 - 12:20 pm

My apologies Jeff. I know it is late, but to close the loop, I agree
this is okay, in at least I don't believe it will harm anything, other
than adding un-necessary bloat at the worst.

Acked-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
--

Previous thread: [PATCH -mm] Fix dev_load() compilation again by Alexey Dobriyan on Friday, September 5, 2008 - 3:32 pm. (5 messages)

Next thread: [patch for 2.6.27? 1/6] drivers/net/skfp/pmf.c: Use offsetof() macro by akpm on Friday, September 5, 2008 - 5:04 pm. (2 messages)