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]
Message-ID: <72041ee7-a618-85d0-4687-76dae2b04bbc@ext.kapsi.fi>
Date:   Mon, 21 Feb 2022 20:25:03 +0200
From:   Mauri Sandberg <maukka@....kapsi.fi>
To:     Andrew Lunn <andrew@...n.ch>
Cc:     netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
        Sebastian Hesselbarth <sebastian.hesselbarth@...il.com>,
        "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>
Subject: Re: [PATCH] net: mv643xx_eth: handle EPROBE_DEFER

Hello Andrew,

On 21.02.22 14:21, Andrew Lunn wrote:
> On Mon, Feb 21, 2022 at 08:24:41AM +0200, Mauri Sandberg wrote:
>> Obtaining MAC address may be deferred in cases when the MAC is stored
>> in NVMEM block and it may now be ready upon the first retrieval attempt
>> returing EPROBE_DEFER. Handle it here and leave logic otherwise as it
>> was.
>>
>> Signed-off-by: Mauri Sandberg <maukka@....kapsi.fi>
>> ---
>>   drivers/net/ethernet/marvell/mv643xx_eth.c | 5 ++++-
>>   1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c
>> index 105247582684..0694f53981f2 100644
>> --- a/drivers/net/ethernet/marvell/mv643xx_eth.c
>> +++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
>> @@ -2740,7 +2740,10 @@ static int mv643xx_eth_shared_of_add_port(struct platform_device *pdev,
>>   		return -EINVAL;
>>   	}
>>   
>> -	of_get_mac_address(pnp, ppd.mac_addr);
>> +	ret = of_get_mac_address(pnp, ppd.mac_addr);
>> +
>> +	if (ret == -EPROBE_DEFER)
>> +		return ret;
> Hi Mauri
>
> There appears to be a follow on issue. There can be multiple ports. So
> it could be the first port does not use a MAC address from the NVMEM,
> but the second one does. The first time in
> mv643xx_eth_shared_of_add_port() is successful and a platform device
> is added. The second port can then fail with -EPROBE_DEFER. That
> causes the probe to fail, but the platform device will not be
> removed. The next time the driver is probed, it will add a second
> platform device for the first port, causing bad things to happen.
>
> Please can you add code to remove the platform device when the probe
> fails.

I am looking at the vector 'port_platdev' that holds pointers to already 
initialised ports. There is this mv643xx_eth_shared_of_remove(), which 
probably could be utilised to remove them. Should I remove the platform 
devices only in case of probe defer or always if probe fails?


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ