patch -- mempool buglet (?)

David Brownell (david-b@pacbell.net)
Tue, 31 Dec 2002 10:18:47 -0800


This is a multi-part message in MIME format.

--Boundary_(ID_3x0onUuOOPQHtsSSMqFJXg)
Content-type: text/plain; charset=us-ascii; format=flowed
Content-transfer-encoding: 7BIT

I noticed this when reading the mempool code ... looked
wrong to me, it was using kfree() not the de-allocator
matching the allocation it just made. This is on a fault
path that likely doesn't get much use.

Compiles, untested, "looks right".

- Dave

--Boundary_(ID_3x0onUuOOPQHtsSSMqFJXg)
Content-type: text/plain; name=mempool.patch
Content-transfer-encoding: 7BIT
Content-disposition: inline; filename=mempool.patch

--- mm/mempool.c-dist Tue Dec 31 10:03:51 2002
+++ mm/mempool.c Tue Dec 31 10:04:24 2002
@@ -142,14 +142,14 @@
element = pool->alloc(gfp_mask, pool->pool_data);
if (!element)
goto out;
spin_lock_irqsave(&pool->lock, flags);
if (pool->curr_nr < pool->min_nr)
add_element(pool, element);
- else
- kfree(element); /* Raced */
+ else /* Raced */
+ pool->free(element, pool->pool_data);
}
out_unlock:
spin_unlock_irqrestore(&pool->lock, flags);
out:
return 0;
}

--Boundary_(ID_3x0onUuOOPQHtsSSMqFJXg)--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/