summaryrefslogtreecommitdiffstats
path: root/sys/cam/cam_periph.c
diff options
context:
space:
mode:
authortrasz <trasz@FreeBSD.org>2008-12-16 17:01:52 +0000
committertrasz <trasz@FreeBSD.org>2008-12-16 17:01:52 +0000
commita06a1075a6719e0d49495a44becc791ba9f37bbc (patch)
tree719d1bc292042a30707867306b2d3f39c863c635 /sys/cam/cam_periph.c
parent1aa4ea9cfb2dc8da2c82c6b4f27eee1e40c731be (diff)
downloadFreeBSD-src-a06a1075a6719e0d49495a44becc791ba9f37bbc.zip
FreeBSD-src-a06a1075a6719e0d49495a44becc791ba9f37bbc.tar.gz
Fix locking in periph drivers - don't try to unlock periph
that was already deallocated. Reviewed by: scottl Approved by: rwatson (mentor) Sponsored by: FreeBSD Foundation
Diffstat (limited to 'sys/cam/cam_periph.c')
-rw-r--r--sys/cam/cam_periph.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/cam/cam_periph.c b/sys/cam/cam_periph.c
index 26fbc6e..907c801 100644
--- a/sys/cam/cam_periph.c
+++ b/sys/cam/cam_periph.c
@@ -311,8 +311,6 @@ cam_periph_hold(struct cam_periph *periph, int priority)
struct mtx *mtx;
int error;
- mtx_assert(periph->sim->mtx, MA_OWNED);
-
/*
* Increment the reference count on the peripheral
* while we wait for our lock attempt to succeed
@@ -324,6 +322,8 @@ cam_periph_hold(struct cam_periph *periph, int priority)
return (ENXIO);
mtx = periph->sim->mtx;
+ mtx_assert(mtx, MA_OWNED);
+
if (mtx == &Giant)
mtx = NULL;
OpenPOWER on IntegriCloud