[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240215202309.29723-1-kovalev@altlinux.org>
Date: Thu, 15 Feb 2024 23:23:09 +0300
From: kovalev@...linux.org
To: netdev@...r.kernel.org
Cc: davem@...emloft.net,
edumazet@...gle.com,
kuba@...nel.org,
pabeni@...hat.com,
jiri@...nulli.us,
jacob.e.keller@...el.com,
johannes@...solutions.net,
idosch@...dia.com,
kovalev@...linux.org
Subject: [PATCH] genetlink: fix potencial use-after-free and null-ptr-deref in genl_dumpit()
From: Vasiliy Kovalev <kovalev@...linux.org>
The pernet operations structure for the subsystem must be registered
before registering the generic netlink family.
Fixes: 134e63756d5f ("genetlink: make netns aware")
Signed-off-by: Vasiliy Kovalev <kovalev@...linux.org>
---
net/netlink/genetlink.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c
index 8c7af02f845400..3bd628675a569f 100644
--- a/net/netlink/genetlink.c
+++ b/net/netlink/genetlink.c
@@ -1879,14 +1879,16 @@ static int __init genl_init(void)
{
int err;
- err = genl_register_family(&genl_ctrl);
- if (err < 0)
- goto problem;
-
err = register_pernet_subsys(&genl_pernet_ops);
if (err)
goto problem;
+ err = genl_register_family(&genl_ctrl);
+ if (err < 0) {
+ unregister_pernet_subsys(&genl_pernet_ops);
+ goto problem;
+ }
+
return 0;
problem:
--
2.33.8
Powered by blists - more mailing lists