Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/netinet6 in6_pcbdetach: now that IGMP and multicast grou...



details:   https://anonhg.NetBSD.org/src/rev/f677a982843e
branches:  trunk
changeset: 331160:f677a982843e
user:      rmind <rmind%NetBSD.org@localhost>
date:      Sun Aug 03 22:55:24 2014 +0000

description:
in6_pcbdetach: now that IGMP and multicast groups are MP-safe, we can move
the ip6_freemoptions() call outside the softnet_lock.  Should fix PR/49065.

diffstat:

 sys/netinet6/in6_pcb.c |  28 ++++++++++++++++------------
 1 files changed, 16 insertions(+), 12 deletions(-)

diffs (57 lines):

diff -r ab5e6fa1b0ca -r f677a982843e sys/netinet6/in6_pcb.c
--- a/sys/netinet6/in6_pcb.c    Sun Aug 03 22:11:50 2014 +0000
+++ b/sys/netinet6/in6_pcb.c    Sun Aug 03 22:55:24 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: in6_pcb.c,v 1.126 2014/07/24 15:12:03 rtr Exp $        */
+/*     $NetBSD: in6_pcb.c,v 1.127 2014/08/03 22:55:24 rmind Exp $      */
 /*     $KAME: in6_pcb.c,v 1.84 2001/02/08 18:02:08 itojun Exp $        */
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in6_pcb.c,v 1.126 2014/07/24 15:12:03 rtr Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6_pcb.c,v 1.127 2014/08/03 22:55:24 rmind Exp $");
 
 #include "opt_inet.h"
 #include "opt_ipsec.h"
@@ -599,24 +599,28 @@
 #if defined(IPSEC)
        if (ipsec_enabled)
                ipsec6_delete_pcbpolicy(in6p);
-#endif /* IPSEC */
-       so->so_pcb = 0;
-       if (in6p->in6p_options)
+#endif
+       so->so_pcb = NULL;
+
+       s = splnet();
+       in6_pcbstate(in6p, IN6P_ATTACHED);
+       LIST_REMOVE(&in6p->in6p_head, inph_lhash);
+       TAILQ_REMOVE(&in6p->in6p_table->inpt_queue, &in6p->in6p_head,
+           inph_queue);
+       splx(s);
+
+       if (in6p->in6p_options) {
                m_freem(in6p->in6p_options);
+       }
        if (in6p->in6p_outputopts != NULL) {
                ip6_clearpktopts(in6p->in6p_outputopts, -1);
                free(in6p->in6p_outputopts, M_IP6OPT);
        }
        rtcache_free(&in6p->in6p_route);
+       sofree(so);                             /* drops the socket's lock */
+
        ip6_freemoptions(in6p->in6p_moptions);
-       s = splnet();
-       in6_pcbstate(in6p, IN6P_ATTACHED);
-       LIST_REMOVE(&in6p->in6p_head, inph_lhash);
-       TAILQ_REMOVE(&in6p->in6p_table->inpt_queue, &in6p->in6p_head,
-           inph_queue);
        pool_put(&in6pcb_pool, in6p);
-       splx(s);
-       sofree(so);                             /* drops the socket's lock */
        mutex_enter(softnet_lock);              /* reacquire it */
 }
 



Home | Main Index | Thread Index | Old Index