freebsd-dev/sys/alpha
Bill Paul ee755665c2 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.

(Somewhere, somebody will say: "But Bill, why don't you just not bother
destroying the maps in this case." Because the API is supposed to be
a) symetrical and b) opaque to the caller. I can't know whether it's safe
to skip the bus_dmamap_destroy() step or not without sticking my fingers
into unsafe places, which is what I wanted to avoid in the first place.)
2001-08-14 21:56:53 +00:00
..
alpha Fix yet another "unconditionally free()ing memory without even checking 2001-08-14 21:56:53 +00:00
compile Don't need the .keep_me files. Obrien and I committed past each other. 2001-07-01 23:35:44 +00:00
conf You were knocked senseless by the Boomerang, spun around by the Cyclone, 2001-07-23 20:44:54 +00:00
include Remove IPI_HALT to make way for a more correct fix for halts and restarts 2001-08-13 22:41:15 +00:00
isa Sanity guard- return ENODEV if we don't have a good IRQ resource. 2001-07-11 02:24:28 +00:00
linux With this commit, I hereby pronounce gensetdefs past its use-by date. 2001-06-13 10:58:39 +00:00
mcbus fix alpha-MD compile errors after the vm_mtx commit 2001-05-20 16:22:46 +00:00
osf1 With Alfred's permission, remove vm_mtx in favor of a fine-grained approach 2001-07-04 16:20:28 +00:00
pci Fix Assembler buglet: Warning: .end directive names different symbol than .ent 2001-06-14 19:33:16 +00:00
tc If we're not going to use am7990_shutdown, comment it all out. 2001-06-14 19:36:37 +00:00
tlsb fix alpha-MD compile errors after the vm_mtx commit 2001-05-20 16:22:46 +00:00
Makefile Add a dopey makefile to do the tags dance, which is probably not perfect 2000-12-31 23:26:34 +00:00