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: <b6d0cbfe-e1cb-44f5-a392-38cad6b40b5c@kernel.org>
Date: Fri, 10 May 2024 19:52:36 -0600
From: David Ahern <dsahern@...nel.org>
To: Hangbin Liu <liuhangbin@...il.com>, netdev@...r.kernel.org
Cc: "David S. Miller" <davem@...emloft.net>,
 Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>,
 Paolo Abeni <pabeni@...hat.com>, Vasiliy Kovalev <kovalev@...linux.org>,
 Sabrina Dubroca <sd@...asysnail.net>, Guillaume Nault <gnault@...hat.com>,
 Simon Horman <horms@...nel.org>, David Lebrun <david.lebrun@...ouvain.be>
Subject: Re: [PATCHv3 net 3/3] ipv6: sr: fix invalid unregister error path

On 5/9/24 7:18 AM, Hangbin Liu wrote:
> 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 46738b1317e1 ("ipv6: sr: add option to control
> lwtunnel support"), and commit 5559cea2d5aa ("ipv6: sr: fix possible
> use-after-free and null-ptr-deref") replaced unregister_pernet_subsys()
> with genl_unregister_family() in this error path.
> 
> Fixes: 46738b1317e1 ("ipv6: sr: add option to control lwtunnel support")
> Reported-by: Guillaume Nault <gnault@...hat.com>
> Signed-off-by: Hangbin Liu <liuhangbin@...il.com>
> ---
>  net/ipv6/seg6.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/net/ipv6/seg6.c b/net/ipv6/seg6.c
> index c4ef96c8fdac..a31521e270f7 100644
> --- a/net/ipv6/seg6.c
> +++ b/net/ipv6/seg6.c
> @@ -551,6 +551,8 @@ int __init seg6_init(void)
>  #endif
>  #ifdef CONFIG_IPV6_SEG6_LWTUNNEL
>  out_unregister_genl:
> +#endif
> +#if IS_ENABLED(CONFIG_IPV6_SEG6_LWTUNNEL) || IS_ENABLED(CONFIG_IPV6_SEG6_HMAC)
>  	genl_unregister_family(&seg6_genl_family);
>  #endif
>  out_unregister_pernet:

a good example of why ifdef's create problems. It would have been
simpler if all of those init functions were defined for both cases and
this function does not need the '#if' spaghetti.

Reviewed-by: David Ahern <dsahern@...nel.org>


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ