From: "Danilo Krummrich" <dakr@kernel.org>
To: "Linkai Gong" <gonglinkai@kylinos.cn>
Cc: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Rafael J . Wysocki" <rafael@kernel.org>,
"Jonathan Cameron" <Jonathan.Cameron@huawei.com>,
"Keith Busch" <kbusch@kernel.org>, <driver-core@lists.linux.dev>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] drivers/base/node: fix UAF on device_register() failure
Date: Fri, 28 Aug 2026 20:07:19 +0200 [thread overview]
Message-ID: <DL0RZMS3MLF3.3AJP3BNVBV03Y@kernel.org> (raw)
In-Reply-To: <20260828012516.3591496-1-gonglinkai@kylinos.cn>
On Fri Aug 28, 2026 at 3:25 AM CEST, Linkai Gong wrote:
> diff --git a/drivers/base/node.c b/drivers/base/node.c
> index 3da91929ad4e..d5eec2ef76dd 100644
> --- a/drivers/base/node.c
> +++ b/drivers/base/node.c
> @@ -171,13 +171,14 @@ static struct node_access_nodes *node_init_node_access(struct node *node,
> goto free;
>
> if (device_register(dev))
> - goto free_name;
> + goto put_device;
>
> pm_runtime_no_callbacks(dev);
> list_add_tail(&access_node->list_node, &node->access_list);
> return access_node;
> -free_name:
> - kfree_const(dev->kobj.name);
> +put_device:
> + put_device(dev);
> + return NULL;
> free:
> kfree(access_node);
> return NULL;
Sorry I didn't notice this in the first version, but why do we keep the goto
labels at all if they both end with a return statement? Can't we just get rid of
both?
Thanks,
Danilo
prev parent reply other threads:[~2026-08-28 18:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-06 8:28 [PATCH] " Linkai Gong
2026-08-06 21:53 ` Danilo Krummrich
2026-08-28 1:25 ` [PATCH v2] " Linkai Gong
2026-08-28 18:07 ` Danilo Krummrich [this message]
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=DL0RZMS3MLF3.3AJP3BNVBV03Y@kernel.org \
--to=dakr@kernel.org \
--cc=Jonathan.Cameron@huawei.com \
--cc=driver-core@lists.linux.dev \
--cc=gonglinkai@kylinos.cn \
--cc=gregkh@linuxfoundation.org \
--cc=kbusch@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rafael@kernel.org \
/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®