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: <20211004122612.GF16442@workstation>
Date:   Mon, 4 Oct 2021 17:56:12 +0530
From:   Manivannan Sadhasivam <mani@...nel.org>
To:     Daniele Palmas <dnlplm@...il.com>
Cc:     Loic Poulain <loic.poulain@...aro.org>,
        "David S . Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        Sergey Ryazanov <ryazanov.s.a@...il.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        netdev@...r.kernel.org, stable@...r.kernel.org
Subject: Re: [PATCH 1/1] drivers: net: mhi: fix error path in mhi_net_newlink

On Mon, Oct 04, 2021 at 01:46:01PM +0200, Daniele Palmas wrote:
> Fix double free_netdev when mhi_prepare_for_transfer fails.
> 
> This is a back-port of upstream:
> commit 4526fe74c3c509 ("drivers: net: mhi: fix error path in mhi_net_newlink")
> 
> Fixes: 13adac032982 ("net: mhi_net: Register wwan_ops for link creation")
> Signed-off-by: Daniele Palmas <dnlplm@...il.com>

Reviewed-by: Manivannan Sadhasivam <mani@...nel.org>

Thanks,
Mani

> ---
> Hello Greg,
> 
> if maintainers ack, this should go just to 5.14 branch.
> 
> Thanks,
> Daniele
> ---
>  drivers/net/mhi/net.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/mhi/net.c b/drivers/net/mhi/net.c
> index e60e38c1f09d..5e49f7a919b6 100644
> --- a/drivers/net/mhi/net.c
> +++ b/drivers/net/mhi/net.c
> @@ -337,7 +337,7 @@ static int mhi_net_newlink(void *ctxt, struct net_device *ndev, u32 if_id,
>  	/* Start MHI channels */
>  	err = mhi_prepare_for_transfer(mhi_dev);
>  	if (err)
> -		goto out_err;
> +		return err;
>  
>  	/* Number of transfer descriptors determines size of the queue */
>  	mhi_netdev->rx_queue_sz = mhi_get_free_desc_count(mhi_dev, DMA_FROM_DEVICE);
> @@ -347,7 +347,7 @@ static int mhi_net_newlink(void *ctxt, struct net_device *ndev, u32 if_id,
>  	else
>  		err = register_netdev(ndev);
>  	if (err)
> -		goto out_err;
> +		return err;
>  
>  	if (mhi_netdev->proto) {
>  		err = mhi_netdev->proto->init(mhi_netdev);
> @@ -359,8 +359,6 @@ static int mhi_net_newlink(void *ctxt, struct net_device *ndev, u32 if_id,
>  
>  out_err_proto:
>  	unregister_netdevice(ndev);
> -out_err:
> -	free_netdev(ndev);
>  	return err;
>  }
>  
> -- 
> 2.30.2
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ