From owner-svn-src-head@FreeBSD.ORG Wed Apr 29 17:18:41 2015 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id EAE3C3ED; Wed, 29 Apr 2015 17:18:41 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D8FEA1C5F; Wed, 29 Apr 2015 17:18:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t3THIfOO020525; Wed, 29 Apr 2015 17:18:41 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t3THIf49020524; Wed, 29 Apr 2015 17:18:41 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201504291718.t3THIf49020524@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Wed, 29 Apr 2015 17:18:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r282239 - head/sys/cam/scsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Apr 2015 17:18:42 -0000 Author: scottl Date: Wed Apr 29 17:18:41 2015 New Revision: 282239 URL: https://svnweb.freebsd.org/changeset/base/282239 Log: Revert r282227. It is clearly incorrect as it frees an object that is still referenced. I think that there does exist an unlikely edge case for a memory leak, but only if a driver is incorrectly written and specifies no valid range of targets to scan. That can be fixed in a follow-up commit. Obtained from: Netflix, Inc. Modified: head/sys/cam/scsi/scsi_xpt.c Modified: head/sys/cam/scsi/scsi_xpt.c ============================================================================== --- head/sys/cam/scsi/scsi_xpt.c Wed Apr 29 17:01:28 2015 (r282238) +++ head/sys/cam/scsi/scsi_xpt.c Wed Apr 29 17:18:41 2015 (r282239) @@ -2008,7 +2008,6 @@ scsi_scan_bus(struct cam_periph *periph, " with status %#x, bus scan halted\n", status); free(scan_info, M_CAMXPT); - scan_info = NULL; request_ccb->ccb_h.status = status; xpt_free_ccb(work_ccb); xpt_done(request_ccb); @@ -2018,7 +2017,6 @@ scsi_scan_bus(struct cam_periph *periph, if (work_ccb == NULL) { xpt_free_ccb((union ccb *)scan_info->cpi); free(scan_info, M_CAMXPT); - scan_info = NULL; xpt_free_path(path); request_ccb->ccb_h.status = CAM_RESRC_UNAVAIL; xpt_done(request_ccb); @@ -2034,7 +2032,6 @@ scsi_scan_bus(struct cam_periph *periph, xpt_action(work_ccb); } - free(scan_info, M_CAMXPT); mtx_lock(mtx); break; }