[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <888265629.6490567.1692478887611.JavaMail.zimbra@nod.at>
Date: Sat, 19 Aug 2023 23:01:27 +0200 (CEST)
From: Richard Weinberger <richard@....at>
To: Minjie Du <duminjie@...o.com>
Cc: anton ivanov <anton.ivanov@...bridgegreys.com>,
Johannes Berg <johannes@...solutions.net>,
Stephen Rothwell <sfr@...b.auug.org.au>,
linux-um <linux-um@...ts.infradead.org>,
linux-kernel <linux-kernel@...r.kernel.org>,
bpf <bpf@...r.kernel.org>,
opensource kernel <opensource.kernel@...o.com>
Subject: Re: [PATCH v4] um: vector: Fix exception handling in
vector_eth_configure()
----- Ursprüngliche Mail -----
> The resource cleanup was incomplete in the implementation
> of the function "vector_eth_configure".
> Thus replace the jump target
> "out_undo_user_init" by "out_free_netdev".
> Delate the orphan function "out_undo_user_init"
>
> PATCH v1-v3: Modify the patch format.
>
> Signed-off-by: Minjie Du <duminjie@...o.com>
> ---
> 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;
I don't think this is correct.
vector_eth_configure() cannot communicate the failure since it is of type void.
So, vector_remove() will run and will call unregister_netdev(). That can cause a double-free.
Thanks,
//richard
Powered by blists - more mailing lists