Source-Changes-HG archive

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

[src/trunk]: src/sys/netinet6 Avoid passing NULL to nd6_dad_duplicated



details:   https://anonhg.NetBSD.org/src/rev/f338c6469358
branches:  trunk
changeset: 321221:f338c6469358
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Wed Mar 07 01:37:24 2018 +0000

description:
Avoid passing NULL to nd6_dad_duplicated

Fix PR kern/53075

diffstat:

 sys/netinet6/nd6_nbr.c |  20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diffs (64 lines):

diff -r 20b93b830fa9 -r f338c6469358 sys/netinet6/nd6_nbr.c
--- a/sys/netinet6/nd6_nbr.c    Tue Mar 06 22:21:01 2018 +0000
+++ b/sys/netinet6/nd6_nbr.c    Wed Mar 07 01:37:24 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nd6_nbr.c,v 1.150 2018/03/06 11:21:31 martin Exp $     */
+/*     $NetBSD: nd6_nbr.c,v 1.151 2018/03/07 01:37:24 ozaki-r Exp $    */
 /*     $KAME: nd6_nbr.c,v 1.61 2001/02/10 16:06:14 jinmei Exp $        */
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nd6_nbr.c,v 1.150 2018/03/06 11:21:31 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nd6_nbr.c,v 1.151 2018/03/07 01:37:24 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1347,7 +1347,8 @@
                }
 
                if (duplicate) {
-                       /* (*dp) will be freed in nd6_dad_duplicated() */
+                       nd6_dad_duplicated(dp);
+                       /* (*dp) has been freed in nd6_dad_duplicated() */
                        dp = NULL;
                } else {
                        /*
@@ -1367,9 +1368,6 @@
                }
        }
 done:
-       if (duplicate)
-               nd6_dad_duplicated(dp);
-
        mutex_exit(&nd6_dad_lock);
 
        if (need_free) {
@@ -1501,7 +1499,8 @@
        /* XXX more checks for loopback situation - see nd6_dad_timer too */
 
        if (duplicate) {
-               nd6_dad_duplicated(dp);
+               if (dp)
+                       nd6_dad_duplicated(dp);
        } else {
                /*
                 * not sure if I got a duplicate.
@@ -1522,11 +1521,12 @@
 
        mutex_enter(&nd6_dad_lock);
        dp = nd6_dad_find(ifa, NULL);
-       if (dp)
+       if (dp) {
                dp->dad_na_icount++;
 
-       /* remove the address. */
-       nd6_dad_duplicated(dp);
+               /* remove the address. */
+               nd6_dad_duplicated(dp);
+       }
 
        mutex_exit(&nd6_dad_lock);
 }



Home | Main Index | Thread Index | Old Index