patch -- mempool buglet (?)

From: David Brownell (david-b@pacbell.net)
Date: Tue Dec 31 2002 - 13:18:47 EST


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


--- 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;
 }

-
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/



This archive was generated by hypermail 2b29 : Tue Dec 31 2002 - 22:00:19 EST