netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Manivannan Sadhasivam <mani@kernel.org>
To: Daniele Palmas <dnlplm@gmail.com>
Cc: Loic Poulain <loic.poulain@linaro.org>,
	"David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	netdev@vger.kernel.org
Subject: Re: [PATCH 1/1] drivers: net: mhi: fix error path in mhi_net_newlink
Date: Fri, 24 Sep 2021 15:19:09 +0530	[thread overview]
Message-ID: <20210924094909.GA19050@workstation> (raw)
In-Reply-To: <20210924092652.3707-1-dnlplm@gmail.com>

On Fri, Sep 24, 2021 at 11:26:52AM +0200, Daniele Palmas wrote:
> Fix double free_netdev when mhi_prepare_for_transfer fails.
> 
> Fixes: 3ffec6a14f24 ("net: Add mhi-net driver")
> Signed-off-by: Daniele Palmas <dnlplm@gmail.com>

I guess this patch should be backported to stable kernels. So please CC stable
list.

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

Thanks,
Mani

> ---
>  drivers/net/mhi_net.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/drivers/net/mhi_net.c b/drivers/net/mhi_net.c
> index d127eb6e9257..aaa628f859fd 100644
> --- a/drivers/net/mhi_net.c
> +++ b/drivers/net/mhi_net.c
> @@ -321,7 +321,7 @@ static int mhi_net_newlink(struct mhi_device *mhi_dev, struct net_device *ndev)
>  	/* 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);
> @@ -331,10 +331,6 @@ static int mhi_net_newlink(struct mhi_device *mhi_dev, struct net_device *ndev)
>  		return err;
>  
>  	return 0;
> -
> -out_err:
> -	free_netdev(ndev);
> -	return err;
>  }
>  
>  static void mhi_net_dellink(struct mhi_device *mhi_dev, struct net_device *ndev)
> -- 
> 2.30.2
> 

  reply	other threads:[~2021-09-24  9:49 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-24  9:26 [PATCH 1/1] drivers: net: mhi: fix error path in mhi_net_newlink Daniele Palmas
2021-09-24  9:49 ` Manivannan Sadhasivam [this message]
2021-09-24 11:11   ` Daniele Palmas
2021-09-24  9:50 ` Loic Poulain
2021-09-24 13:30 ` patchwork-bot+netdevbpf
  -- strict thread matches above, loose matches on Subject: below --
2021-10-04 11:46 Daniele Palmas
2021-10-04 12:19 ` Greg Kroah-Hartman
2021-10-04 12:26 ` Manivannan Sadhasivam
2021-10-06  9:08 ` Sergey Ryazanov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210924094909.GA19050@workstation \
    --to=mani@kernel.org \
    --cc=davem@davemloft.net \
    --cc=dnlplm@gmail.com \
    --cc=kuba@kernel.org \
    --cc=loic.poulain@linaro.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).