Fix race in free() of fastbin chunk: BZ #15073
commit362b47fe09ca9a928d444c7e2f7992f7f61bfc3e
authorMaxim Kuvyrkov <maxim@kugelworks.com>
Mon, 23 Dec 2013 20:44:50 +0000 (24 09:44 +1300)
committerMaxim Kuvyrkov <maxim@kugelworks.com>
Mon, 23 Dec 2013 20:44:50 +0000 (24 09:44 +1300)
tree6279f6a26cf21a076aeee89081d4cc350ed8dc74
parentb9bcbbcbe7afa94442d335811d4a1c1e0c0a1daf
Fix race in free() of fastbin chunk: BZ #15073

Perform sanity check only if we have_lock.  Due to lockless nature of fastbins
we need to be careful derefencing pointers to fastbin entries (chunksize(old)
in this case) in multithreaded environments.

The fix is to add have_lock to the if-condition checks.  The rest of the patch
only makes code more readable.

* malloc/malloc.c (_int_free): Perform sanity check only if we
have_lock.
ChangeLog
NEWS
malloc/malloc.c