lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Thu, 4 Apr 2013 22:17:34 +0000
From:	"Abodunrin, Akeem G" <akeem.g.abodunrin@...el.com>
To:	Ben Hutchings <bhutchings@...arflare.com>,
	"Kirsher, Jeffrey T" <jeffrey.t.kirsher@...el.com>
CC:	"davem@...emloft.net" <davem@...emloft.net>,
	"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
	"gospo@...hat.com" <gospo@...hat.com>,
	"sassmann@...hat.com" <sassmann@...hat.com>,
	Aurélien Guillaume <footplus@...il.com>
Subject: RE: [net-next 05/13] igb: Support to read and export SFF-8472/8079
 data



> -----Original Message-----
> From: Ben Hutchings [mailto:bhutchings@...arflare.com]
> Sent: Thursday, April 04, 2013 12:08 PM
> To: Kirsher, Jeffrey T
> Cc: davem@...emloft.net; Abodunrin, Akeem G; netdev@...r.kernel.org;
> gospo@...hat.com; sassmann@...hat.com; Aurélien Guillaume
> Subject: Re: [net-next 05/13] igb: Support to read and export SFF-8472/8079
> data
> 
> On Thu, 2013-04-04 at 04:37 -0700, Jeff Kirsher wrote:
> > From: "Akeem G. Abodunrin" <akeem.g.abodunrin@...el.com>
> >
> > This patch adds support to read and export SFF-8472/8079 (SFP data)
> > over i2c, through Ethtool.
> [...]
> > --- a/drivers/net/ethernet/intel/igb/igb_ethtool.c
> > +++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c
> [...]
> > +static int igb_get_module_eeprom(struct net_device *netdev,
> > +				 struct ethtool_eeprom *ee, u8 *data) {
> > +	struct igb_adapter *adapter = netdev_priv(netdev);
> > +	struct e1000_hw *hw = &adapter->hw;
> > +	u32 status = E1000_SUCCESS;
> > +	u16 dataword = 0xFF;
> > +	int i = 0;
> > +
> > +	/* Read the first block, SFF-8079, 2 bytes at a time */
> > +	for (i = 0; i < ETH_MODULE_SFF_8079_LEN; i += 2) {
> > +		status = igb_read_phy_reg_i2c(hw, i, &dataword);
> > +		if (status != E1000_SUCCESS)
> > +			/* Error occurred while reading module */
> > +			return -EIO;
> > +
> > +		data[i] = (dataword >> 8) & 0xFF;
> > +		data[i+1] = dataword & 0xFF;
> > +	}
> 
> What if ee->offset != 0 or ee->len < ETH_MODULE_SFF_8079_LEN?
> 
> > +	/* If the second block is requested, check if SFF-8472 is supported. */
> > +	if (ee->len == ETH_MODULE_SFF_8472_LEN) {
> > +		if (data[IGB_SFF_8472_COMP] == IGB_SFF_8472_UNSUP)
> > +			return -EOPNOTSUPP;
> > +
> > +		/* Read the second block, SFF-8472, 2 bytes at a time */
> > +		for (i = ETH_MODULE_SFF_8079_LEN;
> > +		     i < ETH_MODULE_SFF_8472_LEN; i += 2) {
> > +			status = igb_read_phy_reg_i2c(hw, i, &dataword);
> > +			if (status != E1000_SUCCESS)
> > +				return -EIO;
> > +
> > +			data[i] = (dataword >> 8) & 0xFF;
> > +			data[i+1] = dataword & 0xFF;
> > +		}
> > +	}
> [...]
> 
> What if ee->offset != 0 or ETH_MODULE_SFF_8079_LEN < ee->len <
> ETH_MODULE_SFF_8472_LEN?

Thanks Ben,
 
Yes, you are right... I believe this is an oversight. There may be need to use ee->offset as starting point and make sure ETH_MODULE_SFF_8079_LEN or ETH_MODULE_SFF_8472_LEN is within ee->len scope.

We would address this in the follow up patch.

Regards,

~Akeem
> 
> Ben.
> 
> --
> Ben Hutchings, Staff Engineer, Solarflare Not speaking for my employer; that's
> the marketing department's job.
> They asked us to note that Solarflare product names are trademarked.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ