From: Richard Weinberger <richard@nod.at>
To: Minjie Du <duminjie@vivo.com>
Cc: anton ivanov <anton.ivanov@cambridgegreys.com>,
Johannes Berg <johannes@sipsolutions.net>,
Stephen Rothwell <sfr@canb.auug.org.au>,
linux-um <linux-um@lists.infradead.org>,
linux-kernel <linux-kernel@vger.kernel.org>,
bpf <bpf@vger.kernel.org>,
opensource kernel <opensource.kernel@vivo.com>
Subject: Re: [PATCH v4] um: vector: Fix exception handling in vector_eth_configure()
Date: Sat, 19 Aug 2023 23:01:27 +0200 (CEST) [thread overview]
Message-ID: <888265629.6490567.1692478887611.JavaMail.zimbra@nod.at> (raw)
In-Reply-To: <20230706013911.695-1-duminjie@vivo.com>
----- 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@vivo.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
next prev parent reply other threads:[~2023-08-20 0:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-06 1:39 Minjie Du
2023-08-19 21:01 ` Richard Weinberger [this message]
2023-08-21 7:27 ` Anton Ivanov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=888265629.6490567.1692478887611.JavaMail.zimbra@nod.at \
--to=richard@nod.at \
--cc=anton.ivanov@cambridgegreys.com \
--cc=bpf@vger.kernel.org \
--cc=duminjie@vivo.com \
--cc=johannes@sipsolutions.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-um@lists.infradead.org \
--cc=opensource.kernel@vivo.com \
--cc=sfr@canb.auug.org.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®