netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mandeep Singh Baines <msb@google.com>
To: netdev@vger.kernel.org, leitao@linux.vnet.ibm.com, davem@davemloft.net
Cc: thockin@google.com, jeff@garzik.org, joe@perches.com,
	nil@google.com, matthew@wil.cx
Subject: [PATCH] [ETHTOOL]: EEPROM dump no longer works for tg3 and natsemi
Date: Thu, 24 Apr 2008 19:20:30 -0700	[thread overview]
Message-ID: <20080425022030.GA593@google.com> (raw)

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


             reply	other threads:[~2008-04-25  2:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-25  2:20 Mandeep Singh Baines [this message]
2008-04-25  3:57 ` [PATCH] [ETHTOOL]: EEPROM dump no longer works for tg3 and natsemi David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080425022030.GA593@google.com \
    --to=msb@google.com \
    --cc=davem@davemloft.net \
    --cc=jeff@garzik.org \
    --cc=joe@perches.com \
    --cc=leitao@linux.vnet.ibm.com \
    --cc=matthew@wil.cx \
    --cc=netdev@vger.kernel.org \
    --cc=nil@google.com \
    --cc=thockin@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).