svn commit: r268546 - stable/10/sys/cam/ctl

Alexander Motin mav at FreeBSD.org
Sat Jul 12 02:03:29 UTC 2014


Author: mav
Date: Sat Jul 12 02:03:29 2014
New Revision: 268546
URL: http://svnweb.freebsd.org/changeset/base/268546

Log:
  MFC r268419:
  Fix use-after-free on XPT_RESET_BUS.
  
  That command is not queued, so does not use later status update.

Modified:
  stable/10/sys/cam/ctl/ctl_frontend_cam_sim.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/ctl/ctl_frontend_cam_sim.c
==============================================================================
--- stable/10/sys/cam/ctl/ctl_frontend_cam_sim.c	Sat Jul 12 01:59:07 2014	(r268545)
+++ stable/10/sys/cam/ctl/ctl_frontend_cam_sim.c	Sat Jul 12 02:03:29 2014	(r268546)
@@ -505,6 +505,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.
@@ -786,7 +790,8 @@ cfcs_action(struct cam_sim *sim, union c
 
 		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;


More information about the svn-src-all mailing list