From: Hangbin Liu <liuhangbin@gmail.com>
To: Sabrina Dubroca <sd@queasysnail.net>
Cc: netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>,
David Ahern <dsahern@kernel.org>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Vasiliy Kovalev <kovalev@altlinux.org>,
Guillaume Nault <gnault@redhat.com>
Subject: Re: [PATCH net] ipv6: sr: fix invalid unregister error path
Date: Tue, 7 May 2024 17:39:00 +0800 [thread overview]
Message-ID: <Zjn2tNTJF-sq1Aoe@Laptop-X1> (raw)
In-Reply-To: <ZjnxBVJDNkyGgNE6@hog>
On Tue, May 07, 2024 at 11:14:45AM +0200, Sabrina Dubroca wrote:
> 2024-05-07, 16:11:00 +0800, 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.
> >
> > At the same time, add seg6_local_exit() and fix the genl unregister order
> > in seg6_exit().
> >
> > Fixes: 5559cea2d5aa ("ipv6: sr: fix possible use-after-free and null-ptr-deref")
> > Reported-by: Guillaume Nault <gnault@redhat.com>
> > Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
> > ---
> > net/ipv6/seg6.c | 5 ++---
> > 1 file changed, 2 insertions(+), 3 deletions(-)
> >
> > diff --git a/net/ipv6/seg6.c b/net/ipv6/seg6.c
> > index 35508abd76f4..3c5ccc52d0e1 100644
> > --- a/net/ipv6/seg6.c
> > +++ b/net/ipv6/seg6.c
> > @@ -549,10 +549,8 @@ int __init seg6_init(void)
> > seg6_iptunnel_exit();
> > #endif
> > #endif
> > -#ifdef CONFIG_IPV6_SEG6_LWTUNNEL
> > out_unregister_genl:
> > genl_unregister_family(&seg6_genl_family);
>
> That label will be defined but unused for !CONFIG_IPV6_SEG6_LWTUNNEL.
Ah, yes, I will add the CONFIG_IPV6_SEG6_LWTUNNEL definition in v2.
diff --git a/net/ipv6/seg6.c b/net/ipv6/seg6.c
index 3c5ccc52d0e1..6a80d93399ce 100644
--- a/net/ipv6/seg6.c
+++ b/net/ipv6/seg6.c
@@ -549,7 +549,9 @@ int __init seg6_init(void)
seg6_iptunnel_exit();
#endif
#endif
+#ifdef CONFIG_IPV6_SEG6_LWTUNNEL
out_unregister_genl:
+#endif
genl_unregister_family(&seg6_genl_family);
out_unregister_pernet:
unregister_pernet_subsys(&ip6_segments_ops);
Thanks
Hangbin
prev parent reply other threads:[~2024-05-07 9:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-07 8:11 [PATCH net] ipv6: sr: fix invalid unregister error path Hangbin Liu
2024-05-07 9:14 ` Sabrina Dubroca
2024-05-07 9:39 ` Hangbin Liu [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Zjn2tNTJF-sq1Aoe@Laptop-X1 \
--to=liuhangbin@gmail.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=gnault@redhat.com \
--cc=kovalev@altlinux.org \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sd@queasysnail.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.