diff --git a/sys/cam/ctl/ctl_frontend_cam_sim.c b/sys/cam/ctl/ctl_frontend_cam_sim.c index 0e454014b60b..72f8dd81c8b4 100644 --- a/sys/cam/ctl/ctl_frontend_cam_sim.c +++ b/sys/cam/ctl/ctl_frontend_cam_sim.c @@ -460,6 +460,10 @@ cfcs_done(union ctl_io *io) union ccb *ccb; ccb = io->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr; + if (ccb == NULL) { + ctl_free_io(io); + return; + } /* * At this point we should have status. If we don't, that's a bug. @@ -741,7 +745,8 @@ cfcs_action(struct cam_sim *sim, union ccb *ccb) ctl_zero_io(io); /* Save pointers on both sides */ - io->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr = ccb; + if (ccb->ccb_h.func_code == XPT_RESET_DEV) + io->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr = ccb; ccb->ccb_h.io_ptr = io; io->io_hdr.io_type = CTL_IO_TASK;