summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniele Palmas <dnlplm@gmail.com>2021-09-24 11:26:52 +0200
committerDavid S. Miller <davem@davemloft.net>2021-09-24 15:25:05 +0200
commit4526fe74c3c5095cc55931a3a6fb4932f9e06002 (patch)
tree1058149c366e5b0f0aff7856658daae416eb5319
parentsmsc95xx: fix stalled rx after link change (diff)
downloadlinux-4526fe74c3c5095cc55931a3a6fb4932f9e06002.tar.xz
linux-4526fe74c3c5095cc55931a3a6fb4932f9e06002.zip
drivers: net: mhi: fix error path in mhi_net_newlink
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> Reviewed-by: Manivannan Sadhasivam <mani@kernel.org> Reviewed-by: Loic Poulain <loic.poulain@linaro.org> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/mhi_net.c6
1 files changed, 1 insertions, 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)