Page MenuHomeFreeBSD

D14040.1794359982.diff
No OneTemporary

Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None

D14040.1794359982.diff

Index: head/sys/cam/cam_xpt.c
===================================================================
--- head/sys/cam/cam_xpt.c
+++ head/sys/cam/cam_xpt.c
@@ -5374,8 +5374,8 @@
static void
xpt_done_process(struct ccb_hdr *ccb_h)
{
- struct cam_sim *sim;
- struct cam_devq *devq;
+ struct cam_sim *sim = NULL;
+ struct cam_devq *devq = NULL;
struct mtx *mtx = NULL;
#if defined(BUF_TRACKING) || defined(FULL_BUF_TRACKING)
@@ -5418,9 +5418,15 @@
mtx_unlock(&xsoftc.xpt_highpower_lock);
}
- sim = ccb_h->path->bus->sim;
+ /*
+ * Insulate against a race where the periph is destroyed
+ * but CCBs are still not all processed.
+ */
+ if (ccb_h->path->bus)
+ sim = ccb_h->path->bus->sim;
if (ccb_h->status & CAM_RELEASE_SIMQ) {
+ KASSERT(sim, ("sim missing for CAM_RELEASE_SIMQ request"));
xpt_release_simq(sim, /*run_queue*/FALSE);
ccb_h->status &= ~CAM_RELEASE_SIMQ;
}
@@ -5431,9 +5437,12 @@
ccb_h->status &= ~CAM_DEV_QFRZN;
}
- devq = sim->devq;
if ((ccb_h->func_code & XPT_FC_USER_CCB) == 0) {
struct cam_ed *dev = ccb_h->path->device;
+
+ if (sim)
+ devq = sim->devq;
+ KASSERT(devq, ("sim missing for XPT_FC_USER_CCB request"));
mtx_lock(&devq->send_mtx);
devq->send_active--;

File Metadata

Mime Type
text/plain
Expires
Wed, Nov 11, 1:19 AM (8 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41652024
Default Alt Text
D14040.1794359982.diff (1 KB)

Event Timeline