Patch "net: net_netdev: Fix error handling in ntb_netdev_init_module()" has been added to the 5.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    net: net_netdev: Fix error handling in ntb_netdev_init_module()

to the 5.4-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:
     net-net_netdev-fix-error-handling-in-ntb_netdev_init.patch
and it can be found in the queue-5.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 813f3eae0186baa4e07ba0d23b4d366ef4364758
Author: Yuan Can <yuancan@xxxxxxxxxx>
Date:   Thu Nov 24 07:09:17 2022 +0000

    net: net_netdev: Fix error handling in ntb_netdev_init_module()
    
    [ Upstream commit b8f79dccd38edf7db4911c353d9cd792ab13a327 ]
    
    The ntb_netdev_init_module() returns the ntb_transport_register_client()
    directly without checking its return value, if
    ntb_transport_register_client() failed, the NTB client device is not
    unregistered.
    
    Fix by unregister NTB client device when ntb_transport_register_client()
    failed.
    
    Fixes: 548c237c0a99 ("net: Add support for NTB virtual ethernet device")
    Signed-off-by: Yuan Can <yuancan@xxxxxxxxxx>
    Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/ntb_netdev.c b/drivers/net/ntb_netdev.c
index a5bab614ff84..1b7d588ff3c5 100644
--- a/drivers/net/ntb_netdev.c
+++ b/drivers/net/ntb_netdev.c
@@ -484,7 +484,14 @@ static int __init ntb_netdev_init_module(void)
 	rc = ntb_transport_register_client_dev(KBUILD_MODNAME);
 	if (rc)
 		return rc;
-	return ntb_transport_register_client(&ntb_netdev_client);
+
+	rc = ntb_transport_register_client(&ntb_netdev_client);
+	if (rc) {
+		ntb_transport_unregister_client_dev(KBUILD_MODNAME);
+		return rc;
+	}
+
+	return 0;
 }
 module_init(ntb_netdev_init_module);
 



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux