OSDN Git Service

malloc: fix race condition and other bugs in the no-mmu malloc
authorFreeman Wang <xwang@ubicom.com>
Sat, 19 Dec 2009 21:43:00 +0000 (13:43 -0800)
committerAustin Foxley <austinf@cetoncorp.com>
Sat, 19 Dec 2009 21:53:32 +0000 (13:53 -0800)
commit23528282b771d1af3df0fa17f1e909ad3b663f59
treeb51c4b640cf7f22708e027739e322dc573a3d430
parent7dcd83e8bded560b6a2c658889995390d3021a92
malloc: fix race condition and other bugs in the no-mmu malloc

Fixes multiple race conditions on mmb list. This was done by
making the mmb_heap_lock into a recursive lock and making the
regular heap_lock extend to cover the mmb heap handling.

Also move the new_mmb allocation up to before the mmb list is
iterated through to find the insertion point. When the mmb_heap
also runs out and needs to be extended when the regular heap is
just extended, the mmb list could be messed up.

Signed-off-by: Freeman Wang <xwang@ubicom.com>
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
libc/stdlib/malloc/free.c
libc/stdlib/malloc/malloc.c