Source-Changes-HG archive

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

[src/trunk]: src/sys/netinet6 Ensure that the callout of the multicast addres...



details:   https://anonhg.NetBSD.org/src/rev/1dbdea656d3d
branches:  trunk
changeset: 341580:1dbdea656d3d
user:      joerg <joerg%NetBSD.org@localhost>
date:      Thu Nov 12 15:01:06 2015 +0000

description:
Ensure that the callout of the multicast address is valid before
hooking it up.

diffstat:

 sys/netinet6/mld6.c |  11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diffs (48 lines):

diff -r 31a11d8e8cc8 -r 1dbdea656d3d sys/netinet6/mld6.c
--- a/sys/netinet6/mld6.c       Thu Nov 12 14:38:21 2015 +0000
+++ b/sys/netinet6/mld6.c       Thu Nov 12 15:01:06 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mld6.c,v 1.63 2015/08/24 22:21:27 pooka Exp $  */
+/*     $NetBSD: mld6.c,v 1.64 2015/11/12 15:01:06 joerg Exp $  */
 /*     $KAME: mld6.c,v 1.25 2001/01/16 14:14:18 itojun Exp $   */
 
 /*
@@ -102,7 +102,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mld6.c,v 1.63 2015/08/24 22:21:27 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mld6.c,v 1.64 2015/11/12 15:01:06 joerg Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -658,8 +658,12 @@
                in6m->in6m_ifp = ifp;
                in6m->in6m_refcount = 1;
                in6m->in6m_timer = IN6M_TIMER_UNDEF;
+               callout_init(&in6m->in6m_timer_ch, CALLOUT_MPSAFE);
+               callout_setfunc(&in6m->in6m_timer_ch, mld_timeo, in6m);
+
                IFP_TO_IA6(ifp, ia);
                if (ia == NULL) {
+                       callout_destroy(&in6m->in6m_timer_ch);
                        free(in6m, M_IPMADDR);
                        splx(s);
                        *errorp = EADDRNOTAVAIL; /* appropriate? */
@@ -676,6 +680,7 @@
                sockaddr_in6_init(&sin6, maddr6, 0, 0, 0);
                *errorp = if_mcast_op(ifp, SIOCADDMULTI, sin6tosa(&sin6));
                if (*errorp) {
+                       callout_destroy(&in6m->in6m_timer_ch);
                        LIST_REMOVE(in6m, in6m_entry);
                        free(in6m, M_IPMADDR);
                        ifafree(&ia->ia_ifa);
@@ -683,8 +688,6 @@
                        return (NULL);
                }
 
-               callout_init(&in6m->in6m_timer_ch, CALLOUT_MPSAFE);
-               callout_setfunc(&in6m->in6m_timer_ch, mld_timeo, in6m);
                in6m->in6m_timer = timer;
                if (in6m->in6m_timer > 0) {
                        in6m->in6m_state = MLD_REPORTPENDING;



Home | Main Index | Thread Index | Old Index