summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_umtx.c
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2015-03-04 09:31:10 +0000
committerkib <kib@FreeBSD.org>2015-03-04 09:31:10 +0000
commitefbc02bc53bbf64ede10aad57b8138eef1036593 (patch)
tree4ea1247ac26626b61001da8139c5f9b11507bc64 /sys/kern/kern_umtx.c
parent17814a5b03ddffbc09f04c52fe17412399efcd2f (diff)
downloadFreeBSD-src-efbc02bc53bbf64ede10aad57b8138eef1036593.zip
FreeBSD-src-efbc02bc53bbf64ede10aad57b8138eef1036593.tar.gz
MFC r279283:
When failing to claim ownership of a umtx_pi, restore the umutex owner to its previous, unowned state.
Diffstat (limited to 'sys/kern/kern_umtx.c')
-rw-r--r--sys/kern/kern_umtx.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/sys/kern/kern_umtx.c b/sys/kern/kern_umtx.c
index c5f90e0..108ac70 100644
--- a/sys/kern/kern_umtx.c
+++ b/sys/kern/kern_umtx.c
@@ -2106,6 +2106,17 @@ do_lock_pi(struct thread *td, struct umutex *m, uint32_t flags,
error = umtx_pi_claim(pi, td);
umtxq_unbusy(&uq->uq_key);
umtxq_unlock(&uq->uq_key);
+ if (error != 0) {
+ /*
+ * Since we're going to return an
+ * error, restore the m_owner to its
+ * previous, unowned state to avoid
+ * compounding the problem.
+ */
+ (void)casuword32(&m->m_owner,
+ id | UMUTEX_CONTESTED,
+ UMUTEX_CONTESTED);
+ }
break;
}
OpenPOWER on IntegriCloud