2023-07-04 04:47:34

by Minjie Du

[permalink] [raw]
Subject: [PATCH v3] um: vector: Replace undo_user_init in old code with out_free_netdev

Thanks for your response and suggestions,
I made some mistakes. This is a resubmitted patch.
I got some errors with my local repository,
so I lost the commit SHA-1 ID.
Fixes: ("drivers: use free_netdev before return in vector_eth_configure()")
Please check this link to see previous replies.
Link: https://lore.kernel.org/all/[email protected]/

This patch make out_free_netdev replace undo_user_init,
fix etherdev leak in error return path.


Signed-off-by: Minjie Du <[email protected]>
---
arch/um/drivers/vector_kern.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/arch/um/drivers/vector_kern.c b/arch/um/drivers/vector_kern.c
index 131b7cb29..7ae6ab8df 100644
--- a/arch/um/drivers/vector_kern.c
+++ b/arch/um/drivers/vector_kern.c
@@ -1646,7 +1646,7 @@ static void vector_eth_configure(
err = register_netdevice(dev);
rtnl_unlock();
if (err)
- goto out_undo_user_init;
+ goto out_free_netdev;

spin_lock(&vector_devices_lock);
list_add(&device->list, &vector_devices);
@@ -1654,8 +1654,6 @@ static void vector_eth_configure(

return;

-out_undo_user_init:
- return;
out_free_netdev:
free_netdev(dev);
out_free_device:
--
2.39.0