diff options
author | mav <mav@FreeBSD.org> | 2012-10-13 18:24:52 +0000 |
---|---|---|
committer | mav <mav@FreeBSD.org> | 2012-10-13 18:24:52 +0000 |
commit | b2c37a9f0e24e64026ec528ab4294d2b54858cd5 (patch) | |
tree | c5627af3d7107b395e9fa1a59be68981ab141d91 /sys/cam | |
parent | e21d57c65cb602c1de62d9149890014ec958813b (diff) | |
download | FreeBSD-src-b2c37a9f0e24e64026ec528ab4294d2b54858cd5.zip FreeBSD-src-b2c37a9f0e24e64026ec528ab4294d2b54858cd5.tar.gz |
Don't exclude XPT SIM from locking in xpt_create_path_unlocked().
We don't want xpt periph, device, target or bus disappeared because of
incorrect reference counting.
Diffstat (limited to 'sys/cam')
-rw-r--r-- | sys/cam/cam_xpt.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c index 046899c..6288390 100644 --- a/sys/cam/cam_xpt.c +++ b/sys/cam/cam_xpt.c @@ -3441,19 +3441,14 @@ xpt_create_path_unlocked(struct cam_path **new_path_ptr, struct cam_path *path; struct cam_eb *bus = NULL; cam_status status; - int need_unlock = 0; path = (struct cam_path *)malloc(sizeof(*path), M_CAMPATH, M_WAITOK); - if (path_id != CAM_BUS_WILDCARD) { - bus = xpt_find_bus(path_id); - if (bus != NULL) { - need_unlock = 1; - CAM_SIM_LOCK(bus->sim); - } - } + bus = xpt_find_bus(path_id); + if (bus != NULL) + CAM_SIM_LOCK(bus->sim); status = xpt_compile_path(path, periph, path_id, target_id, lun_id); - if (need_unlock) { + if (bus != NULL) { CAM_SIM_UNLOCK(bus->sim); xpt_release_bus(bus); } |