Source-Changes-HG archive

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

[src/netbsd-8]: src/sys/net Pull up following revision(s) (requested by ozaki...



details:   https://anonhg.NetBSD.org/src/rev/6213c5bf43e5
branches:  netbsd-8
changeset: 434957:6213c5bf43e5
user:      martin <martin%NetBSD.org@localhost>
date:      Sat May 05 19:07:51 2018 +0000

description:
Pull up following revision(s) (requested by ozaki-r in ticket #788):

        sys/net/rtsock.c: revision 1.241

Fix a deadlock (rt_free vs. route_intr on rt_so_mtx)
It occurs only if NET_MPSAFE is enabled.

diffstat:

 sys/net/rtsock.c |  18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)

diffs (40 lines):

diff -r 3cd5fbb2aff9 -r 6213c5bf43e5 sys/net/rtsock.c
--- a/sys/net/rtsock.c  Sat May 05 15:14:30 2018 +0000
+++ b/sys/net/rtsock.c  Sat May 05 19:07:51 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rtsock.c,v 1.213.2.9 2018/04/14 10:16:19 martin Exp $  */
+/*     $NetBSD: rtsock.c,v 1.213.2.10 2018/05/05 19:07:51 martin Exp $ */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.213.2.9 2018/04/14 10:16:19 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.213.2.10 2018/05/05 19:07:51 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -928,9 +928,19 @@
        if (old_rtm != NULL)
                Free(old_rtm);
        if (rt) {
-               if (do_rt_free)
+               if (do_rt_free) {
+#ifdef NET_MPSAFE
+                       /*
+                        * Release rt_so_mtx to avoid a deadlock with
+                        * route_intr.
+                        */
+                       mutex_exit(rt_so_mtx);
                        rt_free(rt);
-               else
+                       mutex_enter(rt_so_mtx);
+#else
+                       rt_free(rt);
+#endif
+               } else
                        rt_unref(rt);
        }
     {



Home | Main Index | Thread Index | Old Index