diff options
author | Michał Mirosław <mirq-linux@rere.qmqm.pl> | 2009-05-21 06:34:05 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-05-21 19:50:24 -0400 |
commit | 7ae740df3a9c68622156476dca29991de664fae4 (patch) | |
tree | c2c63d862b9dba337c1eeafc848189e849850346 /net/netlabel | |
parent | 8f698d54532172de3591af1e9394dc669f29e6ca (diff) |
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@rere.qmqm.pl>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/netlabel')
-rw-r--r-- | net/netlabel/netlabel_cipso_v4.c | 16 | ||||
-rw-r--r-- | net/netlabel/netlabel_mgmt.c | 16 | ||||
-rw-r--r-- | net/netlabel/netlabel_unlabeled.c | 16 |
3 files changed, 6 insertions, 42 deletions
diff --git a/net/netlabel/netlabel_cipso_v4.c b/net/netlabel/netlabel_cipso_v4.c index bf1ab1a6790d..e639298bc9c8 100644 --- a/net/netlabel/netlabel_cipso_v4.c +++ b/net/netlabel/netlabel_cipso_v4.c | |||
@@ -785,18 +785,6 @@ static struct genl_ops netlbl_cipsov4_ops[] = { | |||
785 | */ | 785 | */ |
786 | int __init netlbl_cipsov4_genl_init(void) | 786 | int __init netlbl_cipsov4_genl_init(void) |
787 | { | 787 | { |
788 | int ret_val, i; | 788 | return genl_register_family_with_ops(&netlbl_cipsov4_gnl_family, |
789 | 789 | netlbl_cipsov4_ops, ARRAY_SIZE(netlbl_cipsov4_ops)); | |
790 | ret_val = genl_register_family(&netlbl_cipsov4_gnl_family); | ||
791 | if (ret_val != 0) | ||
792 | return ret_val; | ||
793 | |||
794 | for (i = 0; i < ARRAY_SIZE(netlbl_cipsov4_ops); i++) { | ||
795 | ret_val = genl_register_ops(&netlbl_cipsov4_gnl_family, | ||
796 | &netlbl_cipsov4_ops[i]); | ||
797 | if (ret_val != 0) | ||
798 | return ret_val; | ||
799 | } | ||
800 | |||
801 | return 0; | ||
802 | } | 790 | } |
diff --git a/net/netlabel/netlabel_mgmt.c b/net/netlabel/netlabel_mgmt.c index 1821c5d50fb8..8203623e65ad 100644 --- a/net/netlabel/netlabel_mgmt.c +++ b/net/netlabel/netlabel_mgmt.c | |||
@@ -779,18 +779,6 @@ static struct genl_ops netlbl_mgmt_genl_ops[] = { | |||
779 | */ | 779 | */ |
780 | int __init netlbl_mgmt_genl_init(void) | 780 | int __init netlbl_mgmt_genl_init(void) |
781 | { | 781 | { |
782 | int ret_val, i; | 782 | return genl_register_family_with_ops(&netlbl_mgmt_gnl_family, |
783 | 783 | netlbl_mgmt_genl_ops, ARRAY_SIZE(netlbl_mgmt_genl_ops)); | |
784 | ret_val = genl_register_family(&netlbl_mgmt_gnl_family); | ||
785 | if (ret_val != 0) | ||
786 | return ret_val; | ||
787 | |||
788 | for (i = 0; i < ARRAY_SIZE(netlbl_mgmt_genl_ops); i++) { | ||
789 | ret_val = genl_register_ops(&netlbl_mgmt_gnl_family, | ||
790 | &netlbl_mgmt_genl_ops[i]); | ||
791 | if (ret_val != 0) | ||
792 | return ret_val; | ||
793 | } | ||
794 | |||
795 | return 0; | ||
796 | } | 784 | } |
diff --git a/net/netlabel/netlabel_unlabeled.c b/net/netlabel/netlabel_unlabeled.c index f3c5c68c6848..fb357f010189 100644 --- a/net/netlabel/netlabel_unlabeled.c +++ b/net/netlabel/netlabel_unlabeled.c | |||
@@ -1478,20 +1478,8 @@ static struct genl_ops netlbl_unlabel_genl_ops[] = { | |||
1478 | */ | 1478 | */ |
1479 | int __init netlbl_unlabel_genl_init(void) | 1479 | int __init netlbl_unlabel_genl_init(void) |
1480 | { | 1480 | { |
1481 | int ret_val, i; | 1481 | return genl_register_family_with_ops(&netlbl_unlabel_gnl_family, |
1482 | 1482 | netlbl_unlabel_genl_ops, ARRAY_SIZE(netlbl_unlabel_genl_ops)); | |
1483 | ret_val = genl_register_family(&netlbl_unlabel_gnl_family); | ||
1484 | if (ret_val != 0) | ||
1485 | return ret_val; | ||
1486 | |||
1487 | for (i = 0; i < ARRAY_SIZE(netlbl_unlabel_genl_ops); i++) { | ||
1488 | ret_val = genl_register_ops(&netlbl_unlabel_gnl_family, | ||
1489 | &netlbl_unlabel_genl_ops[i]); | ||
1490 | if (ret_val != 0) | ||
1491 | return ret_val; | ||
1492 | } | ||
1493 | |||
1494 | return 0; | ||
1495 | } | 1483 | } |
1496 | 1484 | ||
1497 | /* | 1485 | /* |