Skip to content

Commit

Permalink
firewire: fw-ohci: plug dma memory leak in AR handler
Browse files Browse the repository at this point in the history
There's an ugly little memory leak in firewire-ohci's
ar_context_tasklet(), where we're not freeing up some of the memory we
use for each ar_buffer, due to a moving pointer. The problem has been
there for a while, but didn't get noticed until after converting the AR
routines over to use coherent DMA and I started running into I/O stall-
outs with the following message output repeatedly to the console:

PCI-DMA: Out of IOMMU space for 53248 bytes at device 0000:04:09.0

Plugging this leak is definitely necessary, but unfortunately, isn't the
entire answer to my problem, it only increases the amount of I/O that I
can do before hitting the problem. Still working on tracking down the
root cause..

Signed-off-by: Jarod Wilson <jwilson@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
  • Loading branch information
Jarod Wilson authored and Stefan Richter committed Mar 27, 2008
1 parent 05dda97 commit 6b84236
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions drivers/firewire/fw-ohci.c
Expand Up @@ -401,7 +401,8 @@ static void ar_context_tasklet(unsigned long data)

if (d->res_count == 0) {
size_t size, rest, offset;
dma_addr_t buffer_bus;
dma_addr_t start_bus;
void *start;

/*
* This descriptor is finished and we may have a
Expand All @@ -410,9 +411,9 @@ static void ar_context_tasklet(unsigned long data)
*/

offset = offsetof(struct ar_buffer, data);
buffer_bus = le32_to_cpu(ab->descriptor.data_address) - offset;
start = buffer = ab;
start_bus = le32_to_cpu(ab->descriptor.data_address) - offset;

buffer = ab;
ab = ab->next;
d = &ab->descriptor;
size = buffer + PAGE_SIZE - ctx->pointer;
Expand All @@ -427,7 +428,7 @@ static void ar_context_tasklet(unsigned long data)
buffer = handle_ar_packet(ctx, buffer);

dma_free_coherent(ohci->card.device, PAGE_SIZE,
buffer, buffer_bus);
start, start_bus);
ar_context_add_page(ctx);
} else {
buffer = ctx->pointer;
Expand Down

0 comments on commit 6b84236

Please sign in to comment.