Re: [RFC PATCH 1/2] net: ethtool: Add capability to retrieveplug-in module EEPROM

From: Ben Hutchings
Date: Wed Apr 11 2012 - 14:17:01 EST


On Wed, 2012-04-11 at 17:50 +0100, Stuart Hodgson wrote:
> On 02/04/12 18:52, Ben Hutchings wrote:
[...]
> >> --- a/net/core/ethtool.c
> >> +++ b/net/core/ethtool.c
[...]
> >> + if (eeprom.offset + eeprom.len> modinfo.eeprom_len)
> >> + return -EINVAL;
> >> +
> >> + data = kmalloc(PAGE_SIZE, GFP_USER);
> >> + if (!data)
> >> + return -ENOMEM;
> >
> > What if some device has a larger EEPROM? Surely this length should be
> > eeprom.len.
> >
>
> Do you mean what if the eeprom length in te device is larger than
> PAGE_SIZE?

Yes.

> If so then it should really use modinfo.eeprom_len since
> this the size of the data. eeprom.len could be arbitary.

No, eeprom.len is the size of the data and we've already validated it at
this point.

Ben.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/