aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey V. Elsukov <ae@FreeBSD.org>2021-08-05 08:51:46 +0000
committerAndrey V. Elsukov <ae@FreeBSD.org>2021-08-13 07:37:39 +0000
commit6144be57c0ab08ddeb1a729f698f0997fe142b96 (patch)
tree9132581d749f86e86f906522d4b868717fa22615
parent6004eaaf0fc4f0e7af1cfec335f78e372937d4c4 (diff)
downloadsrc-6144be57c0ab08ddeb1a729f698f0997fe142b96.tar.gz
src-6144be57c0ab08ddeb1a729f698f0997fe142b96.zip
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 Differential Revision: https://reviews.freebsd.org/D31420 (cherry picked from commit d477a7feed177d0ad5c12bc6e2cce804d427ed38)
-rw-r--r--sys/netinet6/in6_mcast.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/sys/netinet6/in6_mcast.c b/sys/netinet6/in6_mcast.c
index bd202e76c6b6..46ed091a193e 100644
--- a/sys/netinet6/in6_mcast.c
+++ b/sys/netinet6/in6_mcast.c
@@ -372,9 +372,18 @@ in6_getmulti(struct ifnet *ifp, const struct in6_addr *group,
IN6_MULTI_LIST_LOCK();
IF_ADDR_WLOCK(ifp);
NET_EPOCH_ENTER_ET(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(et);
+ if (error != 0)
+ goto out_locked;
+
if (inm != NULL) {
/*
* If we already joined this group, just bump the