login
Header Space

 
 

[PATCH] [ETHTOOL]: EEPROM dump no longer works for tg3 and natsemi

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <netdev@...>, <leitao@...>, <davem@...>
Cc: <thockin@...>, <jeff@...>, <joe@...>, <nil@...>, <matthew@...>
Date: Thursday, April 24, 2008 - 10:20 pm

In the ethtool user-space application, tg3 and natsemi over-ride the default
implementation of dump_eeprom(). In both tg3_dump_eeprom() and
natsemi_dump_eeprom(), there is a magic number check which is not present in
the default implementation.

Commit b131dd5d snipped the code which copied the ethtool_eeprom structure
back to user-space. tg3 and natsemi are over-writing the magic number field
and then checking it in user-space. With the ethtool_eeprom copy removed, the
check is failing.

The fix is simple. Add the ethtool_eeprom copy back.

Signed-off-by: Mandeep Singh Baines <msb@google.com>
---
 net/core/ethtool.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index a29b43d..0133b5e 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -323,6 +323,11 @@ static int ethtool_get_eeprom(struct net_device *dev, void __user *useraddr)
 		bytes_remaining -= eeprom.len;
 	}
 
+	eeprom.len = userbuf - (useraddr + sizeof(eeprom));
+	eeprom.offset -= eeprom.len;
+	if (copy_to_user(useraddr, &eeprom, sizeof(eeprom)))
+		ret = -EFAULT;
+
 	kfree(data);
 	return ret;
 }
-- 
1.5.2.5

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] [ETHTOOL]: EEPROM dump no longer works for tg3 and n..., Mandeep Singh Baines, (Thu Apr 24, 10:20 pm)
speck-geostationary