From owner-svn-src-all@FreeBSD.ORG Sat Sep 12 18:55:15 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C74EF106568D; Sat, 12 Sep 2009 18:55:15 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B701C8FC19; Sat, 12 Sep 2009 18:55:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8CItFJM094639; Sat, 12 Sep 2009 18:55:15 GMT (envelope-from bms@svn.freebsd.org) Received: (from bms@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8CItFdP094637; Sat, 12 Sep 2009 18:55:15 GMT (envelope-from bms@svn.freebsd.org) Message-Id: <200909121855.n8CItFdP094637@svn.freebsd.org> From: Bruce M Simpson Date: Sat, 12 Sep 2009 18:55:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r197129 - head/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Sep 2009 18:55:15 -0000 Author: bms Date: Sat Sep 12 18:55:15 2009 New Revision: 197129 URL: http://svn.freebsd.org/changeset/base/197129 Log: 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 Modified: head/sys/netinet/in_mcast.c Modified: head/sys/netinet/in_mcast.c ============================================================================== --- head/sys/netinet/in_mcast.c Sat Sep 12 18:24:31 2009 (r197128) +++ head/sys/netinet/in_mcast.c Sat Sep 12 18:55:15 2009 (r197129) @@ -2189,6 +2189,9 @@ inp_leave_group(struct inpcb *inp, struc if (!IN_MULTICAST(ntohl(gsa->sin.sin_addr.s_addr))) return (EINVAL); + if (ifp == NULL) + return (EADDRNOTAVAIL); + /* * Find the membership in the membership array. */