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  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]
Date:	Thu, 21 May 2009 22:34:05 +0200 (CEST)
From:	Michał Mirosław  
	<mirq-linux@...e.qmqm.pl>
To:	netdev@...r.kernel.org
Subject: [PATCH 4/6 2.6.30-rc6] netlabel: Use genl_register_family_with_ops()

Use genl_register_family_with_ops() instead of a copy. This fixes genetlink
family leak on error path.

Signed-off-by: Michał Mirosław <mirq-linux@...e.qmqm.pl>

diff -urN linux-orig-mqbr/net/netlabel/netlabel_cipso_v4.c linux-mqbr/net/netlabel/netlabel_cipso_v4.c
--- linux-orig-mqbr/net/netlabel/netlabel_cipso_v4.c	2009-03-24 00:12:14.000000000 +0100
+++ linux-mqbr/net/netlabel/netlabel_cipso_v4.c	2009-05-21 17:53:22.000000000 +0200
@@ -785,18 +785,6 @@
  */
 int __init netlbl_cipsov4_genl_init(void)
 {
-	int ret_val, i;
-
-	ret_val = genl_register_family(&netlbl_cipsov4_gnl_family);
-	if (ret_val != 0)
-		return ret_val;
-
-	for (i = 0; i < ARRAY_SIZE(netlbl_cipsov4_ops); i++) {
-		ret_val = genl_register_ops(&netlbl_cipsov4_gnl_family,
-				&netlbl_cipsov4_ops[i]);
-		if (ret_val != 0)
-			return ret_val;
-	}
-
-	return 0;
+	return genl_register_family_with_ops(&netlbl_cipsov4_gnl_family,
+		netlbl_cipsov4_ops, ARRAY_SIZE(netlbl_cipsov4_ops));
 }
diff -urN linux-orig-mqbr/net/netlabel/netlabel_mgmt.c linux-mqbr/net/netlabel/netlabel_mgmt.c
--- linux-orig-mqbr/net/netlabel/netlabel_mgmt.c	2009-03-24 00:12:14.000000000 +0100
+++ linux-mqbr/net/netlabel/netlabel_mgmt.c	2009-05-21 17:53:46.000000000 +0200
@@ -779,18 +779,6 @@
  */
 int __init netlbl_mgmt_genl_init(void)
 {
-	int ret_val, i;
-
-	ret_val = genl_register_family(&netlbl_mgmt_gnl_family);
-	if (ret_val != 0)
-		return ret_val;
-
-	for (i = 0; i < ARRAY_SIZE(netlbl_mgmt_genl_ops); i++) {
-		ret_val = genl_register_ops(&netlbl_mgmt_gnl_family,
-				&netlbl_mgmt_genl_ops[i]);
-		if (ret_val != 0)
-			return ret_val;
-	}
-
-	return 0;
+	return genl_register_family_with_ops(&netlbl_mgmt_gnl_family,
+		netlbl_mgmt_genl_ops, ARRAY_SIZE(netlbl_mgmt_genl_ops));
 }
diff -urN linux-orig-mqbr/net/netlabel/netlabel_unlabeled.c linux-mqbr/net/netlabel/netlabel_unlabeled.c
--- linux-orig-mqbr/net/netlabel/netlabel_unlabeled.c	2009-03-24 00:12:14.000000000 +0100
+++ linux-mqbr/net/netlabel/netlabel_unlabeled.c	2009-05-21 17:49:53.000000000 +0200
@@ -1478,20 +1478,8 @@
  */
 int __init netlbl_unlabel_genl_init(void)
 {
-	int ret_val, i;
-
-	ret_val = genl_register_family(&netlbl_unlabel_gnl_family);
-	if (ret_val != 0)
-		return ret_val;
-
-	for (i = 0; i < ARRAY_SIZE(netlbl_unlabel_genl_ops); i++) {
-		ret_val = genl_register_ops(&netlbl_unlabel_gnl_family,
-				&netlbl_unlabel_genl_ops[i]);
-		if (ret_val != 0)
-			return ret_val;
-	}
-
-	return 0;
+	return genl_register_family_with_ops(&netlbl_unlabel_gnl_family,
+		netlbl_unlabel_genl_ops, ARRAY_SIZE(netlbl_unlabel_genl_ops));
 }
 
 /*
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists