diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2017-12-18 10:05:44 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2017-12-18 10:05:44 +0000 |
commit | e2ddac8f9d45ea0d86bb8b0f17f3ba72b134a406 (patch) | |
tree | 808dff52d22a329be8467439f0dcd3b5c00e70d0 /sys | |
parent | 004c0017be51c5bbf575806db7dbc387c63fa5ca (diff) |
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@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/kern_rwlock.c | 6 |
1 files changed, 5 insertions, 1 deletions
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 <art@openbsd.org> @@ -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 |