From: Daniele Palmas <dnlplm@gmail.com>
To: Loic Poulain <loic.poulain@linaro.org>,
Manivannan Sadhasivam <mani@kernel.org>,
"David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org, Daniele Palmas <dnlplm@gmail.com>
Subject: [PATCH 1/1] drivers: net: mhi: fix error path in mhi_net_newlink
Date: Fri, 24 Sep 2021 11:26:52 +0200 [thread overview]
Message-ID: <20210924092652.3707-1-dnlplm@gmail.com> (raw)
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>
---
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
next reply other threads:[~2021-09-24 9:27 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-24 9:26 Daniele Palmas [this message]
2021-09-24 9:49 ` [PATCH 1/1] drivers: net: mhi: fix error path in mhi_net_newlink Manivannan Sadhasivam
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=20210924092652.3707-1-dnlplm@gmail.com \
--to=dnlplm@gmail.com \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=loic.poulain@linaro.org \
--cc=mani@kernel.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).