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: <00d3b2e3-6c93-0e48-e87b-ebd9c6574e00@seco.com>
Date:   Thu, 3 Nov 2022 15:07:10 -0400
From:   Sean Anderson <sean.anderson@...o.com>
To:     "David S . Miller" <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>, netdev@...r.kernel.org
Cc:     Madalin Bucur <madalin.bucur@....com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] net: fman: Unregister ethernet device on removal

On 11/3/22 14:28, Sean Anderson wrote:
> When the mac device gets removed, it leaves behind the ethernet device.
> This will result in a segfault next time the ethernet device accesses
> mac_dev. Remove the ethernet device when we get removed to prevent
> this. This is not completely reversible, since some resources aren't
> cleaned up properly, but that can be addressed later.
> 
> Fixes: 3933961682a3 ("fsl/fman: Add FMan MAC driver")
> Signed-off-by: Sean Anderson <sean.anderson@...o.com>
> ---
> So... why *do* we have a separate device for the ethernet interface?
> Can't the mac device just register the netdev itself?
> 
>  drivers/net/ethernet/freescale/fman/mac.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/net/ethernet/freescale/fman/mac.c b/drivers/net/ethernet/freescale/fman/mac.c
> index 65df308bad97..13e67f2864be 100644
> --- a/drivers/net/ethernet/freescale/fman/mac.c
> +++ b/drivers/net/ethernet/freescale/fman/mac.c
> @@ -487,12 +487,21 @@ static int mac_probe(struct platform_device *_of_dev)
>  	return err;
>  }
>  
> +static int mac_remove(struct platform_device *pdev)
> +{
> +	struct mac_device *mac_dev = platform_get_drvdata(pdev);
> +
> +	platform_device_unregister(mac_dev->priv->eth_dev);
> +	return 0;
> +}
> +
>  static struct platform_driver mac_driver = {
>  	.driver = {
>  		.name		= KBUILD_MODNAME,
>  		.of_match_table	= mac_match,
>  	},
>  	.probe		= mac_probe,
> +	.remove		= mac_remove,
>  };
>  
>  builtin_platform_driver(mac_driver);

err, this should be [PATCH net]. Sorry, will fix if necessary for a v2.

--Sena

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ