From owner-freebsd-scsi@FreeBSD.ORG Wed Jun 6 14:05:44 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 0FD88106566B; Wed, 6 Jun 2012 14:05:44 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id D4AE88FC1F; Wed, 6 Jun 2012 14:05:43 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 43309B98D; Wed, 6 Jun 2012 10:05:43 -0400 (EDT) From: John Baldwin To: freebsd-fs@freebsd.org Date: Wed, 6 Jun 2012 08:19:05 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p13; KDE/4.5.5; amd64; ; ) References: <20120601125824.GV2358@deviant.kiev.zoral.com.ua> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201206060819.05864.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Wed, 06 Jun 2012 10:05:43 -0400 (EDT) Cc: "Desai, Kashyap" , "Kenneth D. Merry" , "Reddy, Sreekanth" , "freebsd-scsi@freebsd.org" , "McConnell, Stephen" 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 14:05:44 -0000 On Tuesday, June 05, 2012 8:19:05 am 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 correct to me. Can one of the CAM folks (Ken?) review it and commit it? -- John Baldwin