public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* patch -- mempool buglet (?)
@ 2002-12-31 18:18 David Brownell
  2002-12-31 19:27 ` Andrew Morton
  0 siblings, 1 reply; 2+ messages in thread
From: David Brownell @ 2002-12-31 18:18 UTC (permalink / raw)
  To: mingo; +Cc: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 252 bytes --]

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

[-- Attachment #2: mempool.patch --]
[-- Type: text/plain, Size: 494 bytes --]

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-12-31 19:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-12-31 18:18 patch -- mempool buglet (?) David Brownell
2002-12-31 19:27 ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox