summaryrefslogtreecommitdiffstats
path: root/sys/cam/cam_xpt.c
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2009-11-02 08:31:00 +0000
committermav <mav@FreeBSD.org>2009-11-02 08:31:00 +0000
commit66bbab4f7432f51dfa21f458012f153810c6ae7d (patch)
treeb20de6126d0682811667df18126923c85dfba2ae /sys/cam/cam_xpt.c
parent32be6002c2189505febb30d5026202a0eee2ee60 (diff)
downloadFreeBSD-src-66bbab4f7432f51dfa21f458012f153810c6ae7d.zip
FreeBSD-src-66bbab4f7432f51dfa21f458012f153810c6ae7d.tar.gz
The async callback could free the device. If it is a broadcast async,
it doesn't hold device reference, so take our own reference. Submitted by: thompsa
Diffstat (limited to 'sys/cam/cam_xpt.c')
-rw-r--r--sys/cam/cam_xpt.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c
index 700363a..8c568ec 100644
--- a/sys/cam/cam_xpt.c
+++ b/sys/cam/cam_xpt.c
@@ -4022,13 +4022,19 @@ xpt_async(u_int32_t async_code, struct cam_path *path, void *async_arg)
&& path->device->lun_id != CAM_LUN_WILDCARD
&& device->lun_id != CAM_LUN_WILDCARD)
continue;
-
+ /*
+ * The async callback could free the device.
+ * If it is a broadcast async, it doesn't hold
+ * device reference, so take our own reference.
+ */
+ xpt_acquire_device(device);
(*(bus->xport->async))(async_code, bus,
target, device,
async_arg);
xpt_async_bcast(&device->asyncs, async_code,
path, async_arg);
+ xpt_release_device(device);
}
}
OpenPOWER on IntegriCloud