Source-Changes-HG archive

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

[src/trunk]: src/sys/net Don't call ifa_remove with holding psref



details:   https://anonhg.NetBSD.org/src/rev/83ba768be8d9
branches:  trunk
changeset: 350402:83ba768be8d9
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Wed Jan 11 07:03:59 2017 +0000

description:
Don't call ifa_remove with holding psref

diffstat:

 sys/net/link_proto.c |  10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diffs (32 lines):

diff -r 0bbce7b02df2 -r 83ba768be8d9 sys/net/link_proto.c
--- a/sys/net/link_proto.c      Wed Jan 11 04:04:12 2017 +0000
+++ b/sys/net/link_proto.c      Wed Jan 11 07:03:59 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: link_proto.c,v 1.33 2016/12/26 07:25:00 ozaki-r Exp $  */
+/*     $NetBSD: link_proto.c,v 1.34 2017/01/11 07:03:59 ozaki-r Exp $  */
 
 /*-
  * Copyright (c) 1982, 1986, 1993
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: link_proto.c,v 1.33 2016/12/26 07:25:00 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: link_proto.c,v 1.34 2017/01/11 07:03:59 ozaki-r Exp $");
 
 #include <sys/param.h>
 #include <sys/socket.h>
@@ -216,7 +216,13 @@
                        else {
                                /* TBD routing socket */
                                rt_newaddrmsg(RTM_DELETE, ifa, 0, NULL);
+                               /* We need to release psref for ifa_remove */
+                               ifaref(ifa);
+                               ifa_release(ifa, &psref);
                                ifa_remove(ifp, ifa);
+                               KASSERT(ifa->ifa_refcnt == 1);
+                               ifafree(ifa);
+                               ifa = NULL;
                        }
                        break;
                case SIOCALIFADDR:



Home | Main Index | Thread Index | Old Index