From owner-freebsd-scsi@FreeBSD.ORG Wed Jun 6 17:06:42 2012 Return-Path: Delivered-To: freebsd-scsi@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 168471065672; Wed, 6 Jun 2012 17:06:42 +0000 (UTC) (envelope-from ken@kdm.org) Received: from nargothrond.kdm.org (nargothrond.kdm.org [70.56.43.81]) by mx1.freebsd.org (Postfix) with ESMTP id CC4A28FC18; Wed, 6 Jun 2012 17:06:41 +0000 (UTC) Received: from nargothrond.kdm.org (localhost [127.0.0.1]) by nargothrond.kdm.org (8.14.2/8.14.2) with ESMTP id q56H6fXr098454; Wed, 6 Jun 2012 11:06:41 -0600 (MDT) (envelope-from ken@nargothrond.kdm.org) Received: (from ken@localhost) by nargothrond.kdm.org (8.14.2/8.14.2/Submit) id q56H6f3O098453; Wed, 6 Jun 2012 11:06:41 -0600 (MDT) (envelope-from ken) Date: Wed, 6 Jun 2012 11:06:41 -0600 From: "Kenneth D. Merry" To: "Desai, Kashyap" Message-ID: <20120606170640.GA98428@nargothrond.kdm.org> References: <20120601124338.GU2358@deviant.kiev.zoral.com.ua> <20120601125824.GV2358@deviant.kiev.zoral.com.ua> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2i Cc: "freebsd-scsi@freebsd.org" , "freebsd-fs@freebsd.org" , "McConnell, Stephen" , "Reddy, Sreekanth" Subject: Re: Kernel panic in FreeBSD-8.3 from UFS X-BeenThere: freebsd-scsi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SCSI subsystem List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jun 2012 17:06:42 -0000 On Tue, Jun 05, 2012 at 17:49:05 +0530, Desai, Kashyap wrote: > Hi All, > > We found some potential area of memory leak in CAM layer. > CAM XPT Memory leak is due to following function in scsi/scsi_all.c > > int > scsi_command_string(struct ccb_scsiio *csio, struct sbuf *sb) > > > In above function, CAM layer allocate memory for ccb device as below > if ((cgd = (struct ccb_getdev*)xpt_alloc_ccb_nowait()) == NULL) > > > _But_, unfortunately we never free the allocated memory and we see memory leak of 2K every time when someone is calling > Scsi_command_string from kernel mode. > > > Attached is a proposed patch for this issue. The patch looks good, I just committed it. Thanks! Ken -- Kenneth Merry ken@FreeBSD.ORG