Source-Changes-HG archive

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

[src/trunk]: src/sys/net route(4): Work around deadlock in rt_free wait path.



details:   https://anonhg.NetBSD.org/src/rev/b50c539ef39a
branches:  trunk
changeset: 372726:b50c539ef39a
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Thu Dec 22 13:54:57 2022 +0000

description:
route(4): Work around deadlock in rt_free wait path.

PR kern/56844

XXX pullup-8
XXX pullup-9
XXX pullup-10

diffstat:

 sys/net/route.c |  15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

diffs (37 lines):

diff -r b58af17411c7 -r b50c539ef39a sys/net/route.c
--- a/sys/net/route.c   Thu Dec 22 11:10:52 2022 +0000
+++ b/sys/net/route.c   Thu Dec 22 13:54:57 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: route.c,v 1.235 2022/11/25 08:39:32 knakahara Exp $    */
+/*     $NetBSD: route.c,v 1.236 2022/12/22 13:54:57 riastradh Exp $    */
 
 /*-
  * Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
@@ -97,7 +97,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.235 2022/11/25 08:39:32 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.236 2022/12/22 13:54:57 riastradh Exp $");
 
 #include <sys/param.h>
 #ifdef RTFLUSH_DEBUG
@@ -642,8 +642,17 @@
 rt_wait_ok(void)
 {
 
+       /*
+        * This originally returned !cpu_softintr_p(), but that doesn't
+        * work: the caller may hold a lock (probably softnet lock)
+        * that a softint is waiting for, in which case waiting here
+        * would cause a deadlock.  See https://gnats.netbsd.org/56844
+        * for details.  For now, until the locking paths are sorted
+        * out, we just disable the waiting option altogether and
+        * always defer to workqueue.
+        */
        KASSERT(!cpu_intr_p());
-       return !cpu_softintr_p();
+       return false;
 }
 
 void



Home | Main Index | Thread Index | Old Index