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] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 22 Jun 2020 10:05:06 +0800
From:   "luobin (L)" <luobin9@...wei.com>
To:     Andrew Lunn <andrew@...n.ch>
CC:     <davem@...emloft.net>, <linux-kernel@...r.kernel.org>,
        <netdev@...r.kernel.org>, <luoxianjun@...wei.com>,
        <yin.yinshi@...wei.com>, <cloud.wangxiaoyun@...wei.com>
Subject: Re: [PATCH net-next v1 5/5] hinic: add support to get eeprom
 information

On 2020/6/21 0:00, Andrew Lunn wrote:
>> +static int hinic_get_module_eeprom(struct net_device *netdev,
>> +				   struct ethtool_eeprom *ee, u8 *data)
>> +{
>> +	struct hinic_dev *nic_dev = netdev_priv(netdev);
>> +	u8 sfp_data[STD_SFP_INFO_MAX_SIZE];
> 
> sfp_data will contain whatever is on the stack.
> 
>> +	u16 len;
>> +	int err;
>> +
>> +	if (!ee->len || ((ee->len + ee->offset) > STD_SFP_INFO_MAX_SIZE))
>> +		return -EINVAL;
>> +
>> +	memset(data, 0, ee->len);
> 
> This clears what you are going to return.
> 
>> +
>> +	err = hinic_get_sfp_eeprom(nic_dev->hwdev, sfp_data, &len);
> 
> Upto len bytes of sfp_data now contain useful data. The rest of
> sfp_data is still stack data.
> 
> 
>> +	if (err)
>> +		return err;
>> +
>> +	memcpy(data, sfp_data + ee->offset, ee->len);
> 
> If len < ee->len, you have just returned to user space some stack data.
> 
>    Andrew
> .
> 
The whole sfp_data will be assigned values in hinic_get_sfp_eeprom function,
so stack data won't be returned to user space. Thanks for your review.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ