summaryrefslogtreecommitdiffstats
path: root/sys/netinet
diff options
context:
space:
mode:
authorbms <bms@FreeBSD.org>2009-09-12 18:55:15 +0000
committerbms <bms@FreeBSD.org>2009-09-12 18:55:15 +0000
commit3031a90b58b6dada1edd713dd7f75f2b88622ef9 (patch)
tree7fbd060a0254108298f7f6a013fa9f186fda4962 /sys/netinet
parentfbe075bad395a0a28dd31e7151a84867a9b07637 (diff)
downloadFreeBSD-src-3031a90b58b6dada1edd713dd7f75f2b88622ef9.zip
FreeBSD-src-3031a90b58b6dada1edd713dd7f75f2b88622ef9.tar.gz
Fix an API issue in leave processing for IPv4 multicast groups.
* Do not assume that the group lookup performed by imo_match_group() is valid when ifp is NULL in this case. * Instead, return EADDRNOTAVAIL if the ifp cannot be resolved for the membership we are being asked to leave. Caveat user: * The way IPv4 multicast memberships are implemented in the inpcb layer at the moment, has the side-effect that struct ip_moptions will still hold the membership, under the old ifp, until ip_freemoptions() is called for the parent inpcb. * The underlying issue is: the inpcb layer does not get notification of ifp being detached going away in a thread-safe manner. This is non-trivial to fix. But hey, at least the kernel should't panic when you unplug a card. PR: 138689 Submitted by: Stef Walter MFC after: 5 days
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/in_mcast.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sys/netinet/in_mcast.c b/sys/netinet/in_mcast.c
index 9a82821..b0e03f8 100644
--- a/sys/netinet/in_mcast.c
+++ b/sys/netinet/in_mcast.c
@@ -2189,6 +2189,9 @@ inp_leave_group(struct inpcb *inp, struct sockopt *sopt)
if (!IN_MULTICAST(ntohl(gsa->sin.sin_addr.s_addr)))
return (EINVAL);
+ if (ifp == NULL)
+ return (EADDRNOTAVAIL);
+
/*
* Find the membership in the membership array.
*/
OpenPOWER on IntegriCloud