From owner-freebsd-hackers@FreeBSD.ORG Sun Jan 18 05:22:33 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CDEF216A4CE; Sun, 18 Jan 2004 05:22:33 -0800 (PST) Received: from phantom.cris.net (phantom.cris.net [212.110.130.74]) by mx1.FreeBSD.org (Postfix) with ESMTP id 51D0243D39; Sun, 18 Jan 2004 05:22:25 -0800 (PST) (envelope-from ru@FreeBSD.org.ua) Received: from phantom.cris.net (ru@localhost [127.0.0.1]) by phantom.cris.net (8.12.10/8.12.10) with ESMTP id i0IDN5jm031061; Sun, 18 Jan 2004 15:23:05 +0200 (EET) (envelope-from ru@FreeBSD.org.ua) Received: (from ru@localhost) by phantom.cris.net (8.12.10/8.12.10/Submit) id i0IDN4MF031056; Sun, 18 Jan 2004 15:23:05 +0200 (EET) (envelope-from ru) Date: Sun, 18 Jan 2004 15:23:04 +0200 From: Ruslan Ermilov To: Scott Long Message-ID: <20040118132304.GE29936@FreeBSD.org.ua> References: <20040118124502.GD29936@FreeBSD.org.ua> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="E69HUUNAyIJqGpVn" Content-Disposition: inline In-Reply-To: <20040118124502.GD29936@FreeBSD.org.ua> User-Agent: Mutt/1.5.5.1i cc: hackers@FreeBSD.org Subject: Re: [CHECKER] bugs in FreeBSD X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jan 2004 13:22:34 -0000 --E69HUUNAyIJqGpVn Content-Type: multipart/mixed; boundary="ExXT7PjY8AI4Hyfa" Content-Disposition: inline --ExXT7PjY8AI4Hyfa Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Jan 18, 2004 at 02:45:02PM +0200, Ruslan Ermilov wrote: > Scott, >=20 > Attached is the patch that fixes memory leak according to the below repor= t. >=20 Attached is the corrected patch that doesn't do a waiting malloc() while interrupts are blocked. Yes I know that splbio() is a no-op these days. ;) > On Fri, Jan 16, 2004 at 04:09:34PM -0800, Paul Twohey wrote: > > --------------------------------------------------------- > > [BUG] though we should demote things that are not locals. > > /u2/engler/mc/freebsd/sys/i386/compile/GENERIC/../../../dev/ips/ips.c:1= 48:ips_add_waiting_command:ERROR:LEAK:148:154: pointer=3Dwaiter from RO=3Dm= alloc(-1) [s=3D550,pop=3D551,pr=3D1.00] [rank=3Dmed] leaked! [z=3D1.0] [suc= cess=3D5] > >=20 > > ips_command_t *command; > > ips_wait_list_t *waiter; > > unsigned long memflags =3D 0; > > if(IPS_NOWAIT_FLAG & flags) > > memflags =3D M_NOWAIT; > > Start ---> > > waiter =3D malloc(sizeof(ips_wait_list_t), M_DEVBUF, memflags); > > if(!waiter) > > return ENOMEM; > > mask =3D splbio(); > > if(sc->state & IPS_OFFLINE){ > > splx(mask); > > Error ---> > > return EIO; > > } > > command =3D SLIST_FIRST(&sc->free_cmd_list); > > if(command && !(sc->state & IPS_TIMEOUT)){ > > --------------------------------------------------------- Cheers, --=20 Ruslan Ermilov FreeBSD committer ru@FreeBSD.org --ExXT7PjY8AI4Hyfa Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=p Index: ips.c =================================================================== RCS file: /home/ncvs/src/sys/dev/ips/ips.c,v retrieving revision 1.6 diff -u -p -r1.6 ips.c --- ips.c 27 Nov 2003 08:37:36 -0000 1.6 +++ ips.c 18 Jan 2004 13:16:00 -0000 @@ -169,6 +169,7 @@ static int ips_add_waiting_command(ips_s mask = splbio(); if(sc->state & IPS_OFFLINE){ splx(mask); + free(waiter, M_DEVBUF); return EIO; } command = SLIST_FIRST(&sc->free_cmd_list); --ExXT7PjY8AI4Hyfa-- --E69HUUNAyIJqGpVn Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (FreeBSD) iD8DBQFACoi4Ukv4P6juNwoRAnR+AJ9jUp3+wWM0TjUhxfw8N+0anrIm6gCfeZkM +3WeK+ASnWuo6XV9wCs8xOk= =+1At -----END PGP SIGNATURE----- --E69HUUNAyIJqGpVn--