From owner-svn-src-all@FreeBSD.ORG Mon Nov 2 08:31:00 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F14611065693; Mon, 2 Nov 2009 08:31:00 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E019D8FC28; Mon, 2 Nov 2009 08:31:00 +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 nA28V0SO050190; Mon, 2 Nov 2009 08:31:00 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nA28V0iI050188; Mon, 2 Nov 2009 08:31:00 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200911020831.nA28V0iI050188@svn.freebsd.org> From: Alexander Motin Date: Mon, 2 Nov 2009 08:31:00 +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: r198782 - head/sys/cam X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Nov 2009 08:31:01 -0000 Author: mav Date: Mon Nov 2 08:31:00 2009 New Revision: 198782 URL: http://svn.freebsd.org/changeset/base/198782 Log: The async callback could free the device. If it is a broadcast async, it doesn't hold device reference, so take our own reference. Submitted by: thompsa Modified: head/sys/cam/cam_xpt.c Modified: head/sys/cam/cam_xpt.c ============================================================================== --- head/sys/cam/cam_xpt.c Mon Nov 2 07:21:13 2009 (r198781) +++ head/sys/cam/cam_xpt.c Mon Nov 2 08:31:00 2009 (r198782) @@ -4022,13 +4022,19 @@ xpt_async(u_int32_t async_code, struct c && path->device->lun_id != CAM_LUN_WILDCARD && device->lun_id != CAM_LUN_WILDCARD) continue; - + /* + * The async callback could free the device. + * If it is a broadcast async, it doesn't hold + * device reference, so take our own reference. + */ + xpt_acquire_device(device); (*(bus->xport->async))(async_code, bus, target, device, async_arg); xpt_async_bcast(&device->asyncs, async_code, path, async_arg); + xpt_release_device(device); } }