svn commit: r268548 - stable/9/sys/cam/ctl

Alexander Motin mav at FreeBSD.org
Sat Jul 12 02:05:52 UTC 2014


Author: mav
Date: Sat Jul 12 02:05:51 2014
New Revision: 268548
URL: http://svnweb.freebsd.org/changeset/base/268548

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/9/sys/cam/ctl/ctl_frontend_cam_sim.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/sys/   (props changed)

Modified: stable/9/sys/cam/ctl/ctl_frontend_cam_sim.c
==============================================================================
--- stable/9/sys/cam/ctl/ctl_frontend_cam_sim.c	Sat Jul 12 02:04:45 2014	(r268547)
+++ stable/9/sys/cam/ctl/ctl_frontend_cam_sim.c	Sat Jul 12 02:05:51 2014	(r268548)
@@ -512,6 +512,10 @@ cfcs_done(union ctl_io *io)
 	struct cam_sim *sim;
 
 	ccb = io->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr;
+	if (ccb == NULL) {
+		ctl_free_io(io);
+		return;
+	}
 
 	sim = xpt_path_sim(ccb->ccb_h.path);
 	softc = (struct cfcs_softc *)cam_sim_softc(sim);
@@ -799,7 +803,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