All of lore.kernel.org
 help / color / mirror / Atom feed
* + e1000e-prevent-corruption-of-eeprom-nvm.patch added to -mm tree
@ 2008-09-02 19:19 akpm
  2008-09-02 21:58 ` Brandeburg, Jesse
  0 siblings, 1 reply; 11+ messages in thread
From: akpm @ 2008-09-02 19:19 UTC (permalink / raw)
  To: mm-commits
  Cc: chrisl, arvidjaar, bruce.w.allan, jeff, jeffrey.t.kirsher,
	jesse.brandeburg, john.ronciak, peter.p.waskiewicz.jr, pratap,
	zach


The patch titled
     e1000e: prevent corruption of EEPROM/NVM
has been added to the -mm tree.  Its filename is
     e1000e-prevent-corruption-of-eeprom-nvm.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this

The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/

------------------------------------------------------
Subject: e1000e: prevent corruption of EEPROM/NVM
From: Christopher Li <chrisl@vmware.com>

Andrey reports e1000e 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.

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 spinlock_t e1000_eeprom_lock = SPIN_LOCK_UNLOCKED;
+
 /******************************************************************************
  * Set the phy type member in the hw struct.
  *
@@ -4904,6 +4908,15 @@ static s32 e1000_spi_eeprom_ready(struct
  *****************************************************************************/
 s32 e1000_read_eeprom(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
 {
+    s32 ret;
+    spin_lock(&e1000_eeprom_lock);
+    ret = e1000_do_read_eeprom(hw, offset, words, data);
+    spin_unlock(&e1000_eeprom_lock);
+    return ret;
+}
+
+static s32 e1000_do_read_eeprom(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
+{
     struct e1000_eeprom_info *eeprom = &hw->eeprom;
     u32 i = 0;
 
@@ -5236,6 +5249,16 @@ s32 e1000_update_eeprom_checksum(struct 
  *****************************************************************************/
 s32 e1000_write_eeprom(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
 {
+    s32 ret;
+    spin_lock(&e1000_eeprom_lock);
+    ret = e1000_do_write_eeprom(hw, offset, words, data);
+    spin_unlock(&e1000_eeprom_lock);
+    return ret;
+}
+
+
+static s32 e1000_do_write_eeprom(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
+{
     struct e1000_eeprom_info *eeprom = &hw->eeprom;
     s32 status = 0;
 
_

Patches currently in -mm which might be from chrisl@vmware.com are

e1000e-prevent-corruption-of-eeprom-nvm.patch


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2008-09-09  2:21 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-02 19:19 + e1000e-prevent-corruption-of-eeprom-nvm.patch added to -mm tree akpm
2008-09-02 21:58 ` Brandeburg, Jesse
2008-09-02 23:31   ` Zachary Amsden
2008-09-03  0:32     ` + e1000e-prevent-corruption-of-eeprom-nvm.patch added to -mmtree Brandeburg, Jesse
2008-09-03  2:48       ` Christopher Li
2008-09-03  8:17       ` Zachary Amsden
2008-09-03  8:24         ` David Miller
2008-09-03 17:04         ` Andrey Borzenkov
2008-09-09  2:20           ` Allan, Bruce W
2008-09-03  0:44     ` + e1000e-prevent-corruption-of-eeprom-nvm.patch added to -mm tree Ben Hutchings
2008-09-03  3:04       ` Christopher Li

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.