From: Mandeep Singh Baines <msb@google.com>
To: Breno Leitao <leitao@linux.vnet.ibm.com>
Cc: David Miller <davem@davemloft.net>,
thockin@google.com, netdev@vger.kernel.org, jeff@garzik.org,
joe@perches.com, nil@google.com, matthew@wil.cx
Subject: Re: [PATCH] [ETHTOOL]: Add support for large eeproms
Date: Thu, 24 Apr 2008 18:15:40 -0700 [thread overview]
Message-ID: <20080425011540.GA30152@google.com> (raw)
In-Reply-To: <4810EBC5.4060508@linux.vnet.ibm.com>
Hi Breno,
My bad. You are correct. There is a bug. In the ethtool user-space app, 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.
When fixing the ethtool interface to read large EEPROMs, I snipped the code
which copied the ethtool_eeprom structure back to user-space. I thought it
was read-only. Oops. Looks like tg3 and natsemi are over-writing the magic
number field and then checking it in user-space.
The fix is simple. Add the ethtool_eeprom copy back. I will test and send out
a patch shortly.
Thanks much for finding this:)
Regards,
Mandeep
Breno Leitao (leitao@linux.vnet.ibm.com) wrote:
> Mandeep,
>
> Mandeep Singh Baines wrote:
> >I suspect you may have mis-applied the patch. The patch changes both
> >set_eeprom and get_eeprom. I think you may have modified get_eeprom to call
> >ops->set_eeprom instead of ops->get_eeprom. If not, please send me
> >ethtool.c
> >and tg3.c and I can take a look.
>
> Well, IMHO the patch is correctly applied as I could see. I just got the
> David's tree and run a diff between the ethtool.c files (from David's
> tree and mine), and I get the following differences. Note that I just
> add a printk() there to "debug" what was going on.
>
> static int ethtool_get_eeprom(struct net_device *dev, void __user *useraddr)
> {
> struct ethtool_eeprom eeprom;
> - const struct ethtool_ops *ops = dev->ethtool_ops;
> + struct ethtool_ops *ops = dev->ethtool_ops;
> void __user *userbuf = useraddr + sizeof(eeprom);
> u32 bytes_remaining;
> u8 *data;
> int ret = 0;
>
> + printk("<1> ethtool_get_eeprom()\n");
> if (!ops->get_eeprom || !ops->get_eeprom_len)
> return -EOPNOTSUPP;
>
> @@ -330,12 +330,13 @@ static int ethtool_get_eeprom(struct net
> static int ethtool_set_eeprom(struct net_device *dev, void __user
> *useraddr)
> {
> struct ethtool_eeprom eeprom;
> - const struct ethtool_ops *ops = dev->ethtool_ops;
> + struct ethtool_ops *ops = dev->ethtool_ops;
> void __user *userbuf = useraddr + sizeof(eeprom);
> u32 bytes_remaining;
> u8 *data;
> int ret = 0;
>
> + printk("<1> ethtool_set_eeprom()\n");
> if (!ops->set_eeprom || !ops->get_eeprom_len)
> return -EOPNOTSUPP;
>
>
> The patched ethtool.c is at http://rafb.net/p/fWXNwk28.html and tg3.c
> is at http://rapidshare.com/files/110139941/tg3.c.html
>
> --
> Breno Leitão
> leitao@linux.vnet.ibm.com
next prev parent reply other threads:[~2008-04-25 1:16 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1207195123.23161.291.camel@localhost>
2008-04-03 18:00 ` [PATCH] [ETHTOOL]: Add support for large eeproms Mandeep Singh Baines
2008-04-04 0:03 ` Joe Perches
2008-04-04 1:41 ` Mandeep Singh Baines
2008-04-12 9:10 ` Jeff Garzik
2008-04-14 18:03 ` Mandeep Singh Baines
2008-04-15 7:31 ` David Miller
2008-04-15 17:07 ` Tim Hockin
2008-04-16 2:23 ` David Miller
2008-04-24 18:17 ` Breno Leitao
2008-04-24 19:01 ` Mandeep Singh Baines
2008-04-24 20:21 ` Breno Leitao
2008-04-25 1:15 ` Mandeep Singh Baines [this message]
2008-04-15 17:39 ` Mandeep Singh Baines
2008-04-16 2:24 ` David Miller
2008-04-03 2:12 Mandeep Singh Baines
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=20080425011540.GA30152@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).