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:   Wed, 9 Nov 2022 08:31:51 -0800
From:   Eric Dumazet <edumazet@...gle.com>
To:     Wei Yongjun <weiyongjun@...weicloud.com>
Cc:     Wells Lu <wellslutw@...il.com>,
        "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>, Andrew Lunn <andrew@...n.ch>,
        Wei Yongjun <weiyongjun1@...wei.com>, netdev@...r.kernel.org
Subject: Re: [PATCH net] eth: sp7021: drop free_netdev() from spl2sw_init_netdev()

On Wed, Nov 9, 2022 at 7:01 AM Wei Yongjun <weiyongjun@...weicloud.com> wrote:
>
> From: Wei Yongjun <weiyongjun1@...wei.com>
>
> It's not necessary to free netdev allocated with devm_alloc_etherdev()
> and using free_netdev() leads to double free.
>
> Fixes: fd3040b9394c ("net: ethernet: Add driver for Sunplus SP7021")
> Signed-off-by: Wei Yongjun <weiyongjun1@...wei.com>
>
> diff --git a/drivers/net/ethernet/sunplus/spl2sw_driver.c b/drivers/net/ethernet/sunplus/spl2sw_driver.c
> index 9be585237277..c499a14314f1 100644
> --- a/drivers/net/ethernet/sunplus/spl2sw_driver.c
> +++ b/drivers/net/ethernet/sunplus/spl2sw_driver.c
> @@ -287,7 +287,6 @@ static u32 spl2sw_init_netdev(struct platform_device *pdev, u8 *mac_addr,
>         if (ret) {
>                 dev_err(&pdev->dev, "Failed to register net device \"%s\"!\n",
>                         ndev->name);

If the following leads to a double free, how the previous use of
ndev->name would actually work ?

Please test your patch with CONFIG_KASAN=y

> -               free_netdev(ndev);
>                 *r_ndev = NULL;
>                 return ret;
>         }
> --
> 2.34.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ