From: mpi Date: Mon, 18 Dec 2017 10:05:43 +0000 (+0000) Subject: Make rw_exit() always succeed after a panic. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=e8a5fa7b28f13aaabdc4ee58078d26f364a199b9;p=openbsd Make rw_exit() always succeed after a panic. Prevents a deadlock in if_downall() when rw_enter() succeed without really grabbing the lock. Reported by and ok phessler@ --- diff --git a/sys/kern/kern_rwlock.c b/sys/kern/kern_rwlock.c index 399c352f396..88228a224a1 100644 --- a/sys/kern/kern_rwlock.c +++ b/sys/kern/kern_rwlock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_rwlock.c,v 1.32 2017/10/24 08:53:15 mpi Exp $ */ +/* $OpenBSD: kern_rwlock.c,v 1.33 2017/12/18 10:05:43 mpi Exp $ */ /* * Copyright (c) 2002, 2003 Artur Grabowski @@ -287,6 +287,10 @@ _rw_exit(struct rwlock *rwl LOCK_FL_VARS) int wrlock = owner & RWLOCK_WRLOCK; unsigned long set; + /* Avoid deadlocks after panic */ + if (panicstr) + return; + if (wrlock) rw_assert_wrlock(rwl); else