Commit: 51e9b93d604e88a1e09ea5e20467c1fa10d5f6aa
Parent: da79a4534b7dc6c75203b56ada4cf7ac761ecfb3
Author: Szymon Janc <szymon.janc@tieto.com>
Committer: Johan Hedberg <johan.hedberg@intel.com>
Date: 2014-01-09 16:31:34
Tree: c5d970bce672a7373c96014185bf8b2cb183526c

shared: Fix use after free in queue_foreach Function passed to queue_foreach may free queue entry. Make loop safe with that. Fix number of following valgrin reports. Invalid read of size 8 at 0x408EEC: queue_foreach (queue.c:181) by 0x409A0E: can_read_data (mgmt.c:286) by 0x40896C: read_callback (io-glib.c:164) by 0x4E7C3B5: g_main_context_dispatch (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.3800.1) by 0x4E7C707: ??? (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.3800.1) by 0x4E7CB09: g_main_loop_run (in /lib/x86_64-linux-gnu/ libglib-2.0.so.0.3800.1) by 0x40B5FC: tester_run (tester.c:784) by 0x4034F4: main (android-tester.c:2127) Address 0x59603a8 is 8 bytes inside a block of size 16 free'd at 0x4C2B60C: free (in /usr/lib/valgrind/ vgpreload_memcheck-amd64-linux.so) by 0x40910D: queue_remove_all (queue.c:289) by 0x40A0BD: mgmt_unregister_all (mgmt.c:792) by 0x40A0F4: mgmt_unref (mgmt.c:499) by 0x40D814: index_removed_callback (android-tester.c:329) by 0x408EEB: queue_foreach (queue.c:184) by 0x409A0E: can_read_data (mgmt.c:286) by 0x40896C: read_callback (io-glib.c:164) by 0x4E7C3B5: g_main_context_dispatch (in /lib/x86_64-linux-gnu/ libglib-2.0.so.0.3800.1) by 0x4E7C707: ??? (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.3800.1) by 0x4E7CB09: g_main_loop_run (in /lib/x86_64-linux-gnu/ libglib-2.0.so.0.3800.1) by 0x40B5FC: tester_run (tester.c:784)

Diffstat

M src/shared/queue.c | 11 +++++++++- -

1 files changed, 9 insertions(+), 2 deletions(-)

View Full Diff | Patch