Module Name:    src
Committed By:   christos
Date:           Mon Feb 12 18:19:12 UTC 2018

Modified Files:
        src/sys/netinet: ip_output.c

Log Message:
Keep a pointer to the interface of the multicast membership, because the
multicast element itself might go away in in_delmulti (but the interface
can't because we hold the lock). From ozaki-r@


To generate a diff of this commit:
cvs rdiff -u -r1.294 -r1.295 src/sys/netinet/ip_output.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/netinet/ip_output.c
diff -u src/sys/netinet/ip_output.c:1.294 src/sys/netinet/ip_output.c:1.295
--- src/sys/netinet/ip_output.c:1.294	Wed Feb  7 01:21:23 2018
+++ src/sys/netinet/ip_output.c	Mon Feb 12 13:19:12 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_output.c,v 1.294 2018/02/07 06:21:23 mrg Exp $	*/
+/*	$NetBSD: ip_output.c,v 1.295 2018/02/12 18:19:12 christos Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.294 2018/02/07 06:21:23 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.295 2018/02/12 18:19:12 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1927,9 +1927,10 @@ ip_drop_membership(struct ip_moptions *i
 	 * Give up the multicast address record to which the
 	 * membership points.
 	 */
-	IFNET_LOCK(imo->imo_membership[i]->inm_ifp);
+	struct ifnet *inm_ifp = imo->imo_membership[i]->inm_ifp;
+	IFNET_LOCK(inm_ifp);
 	in_delmulti(imo->imo_membership[i]);
-	IFNET_UNLOCK(imo->imo_membership[i]->inm_ifp);
+	IFNET_UNLOCK(inm_ifp);
 
 	/*
 	 * Remove the gap in the membership array.

Reply via email to