Skip to content

Commit 160e9d2

Browse files
liuhangbinkuba-moo
authored andcommitted
ipv6: sr: fix invalid unregister error path
The error path of seg6_init() is wrong in case CONFIG_IPV6_SEG6_LWTUNNEL is not defined. In that case if seg6_hmac_init() fails, the genl_unregister_family() isn't called. This issue exist since commit 46738b1 ("ipv6: sr: add option to control lwtunnel support"), and commit 5559cea ("ipv6: sr: fix possible use-after-free and null-ptr-deref") replaced unregister_pernet_subsys() with genl_unregister_family() in this error path. Fixes: 46738b1 ("ipv6: sr: add option to control lwtunnel support") Reported-by: Guillaume Nault <[email protected]> Signed-off-by: Hangbin Liu <[email protected]> Reviewed-by: Sabrina Dubroca <[email protected]> Reviewed-by: David Ahern <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 6e370a7 commit 160e9d2

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

net/ipv6/seg6.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,8 @@ int __init seg6_init(void)
551551
#endif
552552
#ifdef CONFIG_IPV6_SEG6_LWTUNNEL
553553
out_unregister_genl:
554+
#endif
555+
#if IS_ENABLED(CONFIG_IPV6_SEG6_LWTUNNEL) || IS_ENABLED(CONFIG_IPV6_SEG6_HMAC)
554556
genl_unregister_family(&seg6_genl_family);
555557
#endif
556558
out_unregister_pernet:

0 commit comments

Comments
 (0)