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
This commit is contained in:
Alexander Motin 2009-11-02 08:31:00 +00:00
parent 4054af4fb0
commit 9efda2c908
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=198782

View File

@ -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);
}
}