aboutsummaryrefslogtreecommitdiff
path: root/sys/cam/cam_xpt.c
diff options
context:
space:
mode:
authorAlexander Motin <mav@FreeBSD.org>2013-10-22 12:58:22 +0000
committerAlexander Motin <mav@FreeBSD.org>2013-10-22 12:58:22 +0000
commit8ec5ab3f1620aca1befd26544299f23b926e98ae (patch)
tree974b57bcf2d078145b02b9eeb3eebcc37f080619 /sys/cam/cam_xpt.c
parent7ef4b2a5de3e5038651404ab5f9530020daaaab1 (diff)
downloadsrc-8ec5ab3f1620aca1befd26544299f23b926e98ae.tar.gz
src-8ec5ab3f1620aca1befd26544299f23b926e98ae.zip
Unconditionally acquire periph reference on CCB allocation failure.
cam_periph_acquire() can return error if periph already invalidated, but that may be unacceptable and cause deadlock if the invalidated periph can't be destroyed without "executing" the scheduled request. Coverity CID: 1109822 MFC after: 2 months
Notes
Notes: svn path=/head/; revision=256888
Diffstat (limited to 'sys/cam/cam_xpt.c')
-rw-r--r--sys/cam/cam_xpt.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c
index 8d635e881070..f241bbcd3ba3 100644
--- a/sys/cam/cam_xpt.c
+++ b/sys/cam/cam_xpt.c
@@ -3163,10 +3163,11 @@ restart:
ccb = xpt_get_ccb(periph);
goto restart;
}
- if (periph->flags & CAM_PERIPH_RUN_TASK) {
+ if (periph->flags & CAM_PERIPH_RUN_TASK)
break;
- }
- cam_periph_acquire(periph);
+ xpt_lock_buses();
+ periph->refcount++; /* Unconditionally acquire */
+ xpt_unlock_buses();
periph->flags |= CAM_PERIPH_RUN_TASK;
taskqueue_enqueue(xsoftc.xpt_taskq,
&periph->periph_run_task);