From owner-svn-src-head@FreeBSD.ORG Sat Jun 5 08:58:04 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 01CDB106566C; Sat, 5 Jun 2010 08:58:04 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E5FE68FC16; Sat, 5 Jun 2010 08:58:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o558w3fC071039; Sat, 5 Jun 2010 08:58:03 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o558w3ZE071036; Sat, 5 Jun 2010 08:58:03 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201006050858.o558w3ZE071036@svn.freebsd.org> From: Alexander Motin Date: Sat, 5 Jun 2010 08:58:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r208822 - head/sys/dev/ata X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 05 Jun 2010 08:58:04 -0000 Author: mav Date: Sat Jun 5 08:58:03 2010 New Revision: 208822 URL: http://svn.freebsd.org/changeset/base/208822 Log: Fix possible use after free. Found with: Coverity Prevent(tm) CID: 4634 Modified: head/sys/dev/ata/atapi-cam.c Modified: head/sys/dev/ata/atapi-cam.c ============================================================================== --- head/sys/dev/ata/atapi-cam.c Sat Jun 5 08:50:39 2010 (r208821) +++ head/sys/dev/ata/atapi-cam.c Sat Jun 5 08:58:03 2010 (r208822) @@ -868,11 +868,11 @@ free_hcb(struct atapi_hcb *hcb) static void free_softc(struct atapi_xpt_softc *scp) { - struct atapi_hcb *hcb; + struct atapi_hcb *hcb, *thcb; if (scp != NULL) { mtx_lock(&scp->state_lock); - TAILQ_FOREACH(hcb, &scp->pending_hcbs, chain) { + TAILQ_FOREACH_SAFE(hcb, &scp->pending_hcbs, chain, thcb) { free_hcb_and_ccb_done(hcb, CAM_UNREC_HBA_ERROR); } if (scp->path != NULL) {