Date: Sat, 12 Jul 2014 02:05:52 +0000 (UTC) From: Alexander Motin <mav@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r268548 - stable/9/sys/cam/ctl Message-ID: <201407120205.s6C25qo9016651@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201407120205.s6C25qo9016651>