From owner-cvs-all Tue Aug 14 15:16:45 2001 Delivered-To: cvs-all@freebsd.org Received: from smtp9.xs4all.nl (smtp9.xs4all.nl [194.109.127.135]) by hub.freebsd.org (Postfix) with ESMTP id 68A5637B40E; Tue, 14 Aug 2001 15:16:35 -0700 (PDT) (envelope-from wkb@freebie.xs4all.nl) Received: from freebie.xs4all.nl (freebie.xs4all.nl [213.84.32.253]) by smtp9.xs4all.nl (8.9.3/8.9.3) with ESMTP id AAA09804; Wed, 15 Aug 2001 00:16:33 +0200 (CEST) Received: (from wkb@localhost) by freebie.xs4all.nl (8.11.4/8.11.4) id f7EMGX841241; Wed, 15 Aug 2001 00:16:33 +0200 (CEST) (envelope-from wkb) Date: Wed, 15 Aug 2001 00:16:33 +0200 From: Wilko Bulte To: Bill Paul Cc: cvs-committers@FreeBSD.ORG, cvs-all@FreeBSD.ORG Subject: Re: cvs commit: src/sys/alpha/alpha busdma_machdep.c Message-ID: <20010815001633.A41207@freebie.xs4all.nl> References: <200108142156.f7ELurE44643@freefall.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <200108142156.f7ELurE44643@freefall.freebsd.org>; from wpaul@FreeBSD.ORG on Tue, Aug 14, 2001 at 02:56:53PM -0700 X-OS: FreeBSD 4.3-STABLE X-PGP: finger wilko@freebsd.org Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Tue, Aug 14, 2001 at 02:56:53PM -0700, Bill Paul wrote: > wpaul 2001/08/14 14:56:53 PDT > > Modified files: > sys/alpha/alpha busdma_machdep.c > Log: > Fix yet another "unconditionally free()ing memory without even checking > to see if it was malloc()ed first" bug. In bus_dmamap_create(), one of > two things can happen: either we need to allocate a special map due to > some manner of bounce buffering requirement, or we can DMA a buffer > in place. On the x86 platform, the "in place" case results in > bus_dmamap_create() returning a dmamap of NULL. The bus_dmamap_destroy() > routine later checks for NULL and won't bother free()ing the map if > it detects this condition. > > But on the alpha, we don't use NULL, we use a statically allocated map > called nobounce_dmamap(). Unfortunately, bus_dmamap_destroy() does not > handle the condition where we attempt to destroy such a map: it tries > to free() the dmamap, which causes a panic. > > Fix: test that map != &nobounce_dmamap before trying to free() it. > > With this fix, my busdma-ified if_sis driver works on the alpha. I'm > a bit alarmed that I'm the first person ever to trip over this bug, since > we have been using busdma on the alpha for a while, and since it sort > of screams out "Hi! I'm a bug! Booga-booga!" when you look at it. The reason is probably the same as for most of port-issues found on alpha: there are not nearly as many Alpha owners, let alone testers as for x86 :-( Wilko [eyes his 3 alphas who all refuse to boot 4.4-PRE from CD] -- | / o / / _ Arnhem, The Netherlands email: wilko@FreeBSD.org |/|/ / / /( (_) Bulte To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message