Source-Changes-HG archive

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

[src/trunk]: src/sys/net PR/45764, PR/45914



details:   https://anonhg.NetBSD.org/src/rev/48901e1bc1a0
branches:  trunk
changeset: 773475:48901e1bc1a0
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Feb 03 03:35:30 2012 +0000

description:
PR/45764, PR/45914
Part 2:
Arrange so that the pointers that we free (ifp->if_afdata, dom->dom_ifqueues[i])
are set to NULL.
While I am here, add a continue.

diffstat:

 sys/net/if.c |  21 ++++++++++++++-------
 1 files changed, 14 insertions(+), 7 deletions(-)

diffs (54 lines):

diff -r 40b95d010513 -r 48901e1bc1a0 sys/net/if.c
--- a/sys/net/if.c      Fri Feb 03 03:32:45 2012 +0000
+++ b/sys/net/if.c      Fri Feb 03 03:35:30 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if.c,v 1.259 2011/12/28 02:14:57 dyoung Exp $  */
+/*     $NetBSD: if.c,v 1.260 2012/02/03 03:35:30 christos Exp $        */
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.259 2011/12/28 02:14:57 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.260 2012/02/03 03:35:30 christos Exp $");
 
 #include "opt_inet.h"
 
@@ -810,13 +810,18 @@
        /* Walk the routing table looking for stragglers. */
        for (i = 0; i <= AF_MAX; i++) {
                while (rt_walktree(i, if_rt_walktree, ifp) == ERESTART)
-                       ;
+                       continue;
        }
 
        DOMAIN_FOREACH(dp) {
                if (dp->dom_ifdetach != NULL && ifp->if_afdata[dp->dom_family])
-                       (*dp->dom_ifdetach)(ifp,
-                           ifp->if_afdata[dp->dom_family]);
+               {
+                       void *p = ifp->if_afdata[dp->dom_family];
+                       if (p) {
+                               ifp->if_afdata[dp->dom_family] = NULL;
+                               (*dp->dom_ifdetach)(ifp, p);
+                       }
+               }
 
                /*
                 * One would expect multicast memberships (INET and
@@ -859,9 +864,11 @@
         */
        DOMAIN_FOREACH(dp) {
                for (i = 0; i < __arraycount(dp->dom_ifqueues); i++) {
-                       if (dp->dom_ifqueues[i] == NULL)
+                       struct ifqueue *iq = dp->dom_ifqueues[i];
+                       if (iq == NULL)
                                break;
-                       if_detach_queues(ifp, dp->dom_ifqueues[i]);
+                       dp->dom_ifqueues[i] = NULL;
+                       if_detach_queues(ifp, iq);
                }
        }
 



Home | Main Index | Thread Index | Old Index