This is a note to let you know that I've just added the patch titled drivers: net: mhi: fix error path in mhi_net_newlink to the 5.14-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: drivers-net-mhi-fix-error-path-in-mhi_net_newlink.patch and it can be found in the queue-5.14 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 4526fe74c3c5095cc55931a3a6fb4932f9e06002 Mon Sep 17 00:00:00 2001 From: Daniele Palmas <dnlplm@xxxxxxxxx> Date: Fri, 24 Sep 2021 11:26:52 +0200 Subject: drivers: net: mhi: fix error path in mhi_net_newlink From: Daniele Palmas <dnlplm@xxxxxxxxx> commit 4526fe74c3c5095cc55931a3a6fb4932f9e06002 upstream. Fix double free_netdev when mhi_prepare_for_transfer fails. Fixes: 3ffec6a14f24 ("net: Add mhi-net driver") Signed-off-by: Daniele Palmas <dnlplm@xxxxxxxxx> Reviewed-by: Manivannan Sadhasivam <mani@xxxxxxxxxx> Reviewed-by: Loic Poulain <loic.poulain@xxxxxxxxxx> Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/net/mhi/net.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) --- a/drivers/net/mhi/net.c +++ b/drivers/net/mhi/net.c @@ -337,7 +337,7 @@ static int mhi_net_newlink(void *ctxt, s /* 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, s 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, s out_err_proto: unregister_netdevice(ndev); -out_err: - free_netdev(ndev); return err; } Patches currently in stable-queue which might be from dnlplm@xxxxxxxxx are queue-5.14/drivers-net-mhi-fix-error-path-in-mhi_net_newlink.patch