lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250912195339.20635-7-yana2bsh@gmail.com>
Date: Fri, 12 Sep 2025 22:53:29 +0300
From: Yana Bashlykova <yana2bsh@...il.com>
To: "David S. Miller" <davem@...emloft.net>
Cc: Yana Bashlykova <yana2bsh@...il.com>,
	Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>,
	Paolo Abeni <pabeni@...hat.com>,
	linux-kernel@...r.kernel.org,
	netdev@...r.kernel.org,
	lvc-project@...uxtesting.org
Subject: [PATCH 6.1 06/15] genetlink: add netlink notifier support

Add basic netlink notifier to monitor genetlink events:
- Simple ntf_genl_event() callback returning NOTIFY_OK
- Register/unregister in module init/exit
- Error handling for registration

Prepares infrastructure for tracking family registration events.

Signed-off-by: Yana Bashlykova <yana2bsh@...il.com>
---
 .../net-pf-16-proto-16-family-PARALLEL_GENL.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/drivers/net/genetlink/net-pf-16-proto-16-family-PARALLEL_GENL.c b/drivers/net/genetlink/net-pf-16-proto-16-family-PARALLEL_GENL.c
index 245f3b0f4fbb..cdedd77b2a1b 100644
--- a/drivers/net/genetlink/net-pf-16-proto-16-family-PARALLEL_GENL.c
+++ b/drivers/net/genetlink/net-pf-16-proto-16-family-PARALLEL_GENL.c
@@ -1116,6 +1116,16 @@ static struct genl_family incorrect_ops_genl_family = {
 	.policy = my_genl_policy, // random policy
 };
 
+static int ntf_genl_event(struct notifier_block *nb, unsigned long state,
+			  void *_notify)
+{
+	return NOTIFY_OK;
+}
+
+static struct notifier_block genl_notifier = {
+	.notifier_call = ntf_genl_event,
+};
+
 static int __init init_netlink(void)
 {
 	int rc;
@@ -1291,8 +1301,16 @@ static int __init module_netlink_init(void)
 	if (ret)
 		pr_err("%s: Incorrect Generic Netlink family wasn't registered\n", __func__);
 
+	ret = netlink_register_notifier(&genl_notifier);
+	if (ret)
+		goto err_family;
+
 	return 0;
 
+	// netlink_unregister_notifier(&genl_notifier);
+err_family:
+	genl_unregister_family(&my_genl_family);
+	genl_unregister_family(&my_genl_family_parallel);
 err_sysfs:
 	sysfs_remove_file(kobj_genl_test, &my_attr_u32_genl_test.attr);
 	sysfs_remove_file(kobj_genl_test, &my_attr_str_genl_test.attr);
@@ -1309,6 +1327,7 @@ static int __init module_netlink_init(void)
 
 static void __exit module_netlink_exit(void)
 {
+	netlink_unregister_notifier(&genl_notifier);
 	genl_unregister_family(&my_genl_family);
 	genl_unregister_family(&my_genl_family_parallel);
 
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ