Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 6 Aug 2021 10:00:53 GMT
From:      "Andrey V. Elsukov" <ae@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: d477a7feed17 - main - Fix panic in IPv6 multicast code.
Message-ID:  <202108061000.176A0r7R085617@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by ae:

URL: https://cgit.FreeBSD.org/src/commit/?id=d477a7feed177d0ad5c12bc6e2cce804d427ed38

commit d477a7feed177d0ad5c12bc6e2cce804d427ed38
Author:     Andrey V. Elsukov <ae@FreeBSD.org>
AuthorDate: 2021-08-05 08:51:46 +0000
Commit:     Andrey V. Elsukov <ae@FreeBSD.org>
CommitDate: 2021-08-06 09:57:59 +0000

    Fix panic in IPv6 multicast code.
    
    Add check that ifp supports IPv6 multicasts in in6_getmulti.
    This fixes panic when user application tries to join into multicast
    group on an interface that doesn't support IPv6 multicasts, like
    IFT_PFLOG interfaces.
    
    PR:             257302
    Reviewed by:    melifaro
    MFC after:      1 week
    Differential Revision: https://reviews.freebsd.org/D31420
---
 sys/netinet6/in6_mcast.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/sys/netinet6/in6_mcast.c b/sys/netinet6/in6_mcast.c
index 0744a1178fc7..7326befc6d01 100644
--- a/sys/netinet6/in6_mcast.c
+++ b/sys/netinet6/in6_mcast.c
@@ -374,9 +374,18 @@ in6_getmulti(struct ifnet *ifp, const struct in6_addr *group,
 	IN6_MULTI_LIST_LOCK();
 	IF_ADDR_WLOCK(ifp);
 	NET_EPOCH_ENTER(et);
-	inm = in6m_lookup_locked(ifp, group);
+	/*
+	 * Does ifp support IPv6 multicasts?
+	 */
+	if (ifp->if_afdata[AF_INET6] == NULL)
+		error = ENODEV;
+	else
+		inm = in6m_lookup_locked(ifp, group);
 	NET_EPOCH_EXIT(et);
 
+	if (error != 0)
+		goto out_locked;
+
 	if (inm != NULL) {
 		/*
 		 * If we already joined this group, just bump the



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202108061000.176A0r7R085617>