: EEPROM dump no longer works for tg3 and natsemi
Subsystems (2)
PATCH 1/1 : EEPROM dump no longer works for tg3 and natsemi
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.
--- net/core/ethtool.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
net/core/ethtool.c +5 -0
@@ -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; }
Signature · 1 line
1.5.2.5
David Miller
maintainerFrom: Mandeep Singh Baines <[email protected]>
Date: Thu, 24 Apr 2008 19:20:30 -0700
Quoted 5 lines
In the ethtool user-space application, tg3 and natsemi over-ride the default implementation of
dump_eeprom(). In bothtg3_dump_eeprom()andnatsemi_dump_eeprom(), there is a magic number check which is not present in the default implementation.
Quoted 8 lines
Commit
b131dd5dsnipped the code which copied theethtool_eepromstructure back to user-space. tg3 and natsemi are over-writing the magic number field and then checking it in user-space. With theethtool_eepromcopy removed, the check is failing.The fix is simple. Add the
ethtool_eepromcopy back.Signed-off-by Mandeep Singh Baines <[email protected]>
Patch applied, thank you for fixing this bug.
Could you make a minor modification to your changelog comments in the future? When referencing an SHA ID commit, please include the header text line from the changelog. In this way, if the commit ID changes for whatever reason, people can still figure out what commit you're referencing.
For example, I changed your second paragraph to read:
--------------------
Commit b131dd5d ("[ETHTOOL]: Add support for large eeproms") 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.
--------------------
when I added your change.
Thanks!