drm/etnaviv
Marek Vasut cecedcb8a1 etnaviv: Fix double-free in etna_bo_cache_free()
The following situation can happen in a multithreaded OpenGL application.
A BO is submitted from etna_cmd_stream #1 with flags set for read.
A BO is submitted from etna_cmd_stream #2 with flags set for write.
This triggers a flush on stream #1 and clears the BO's current_stream
pointer. If at this point, stream #2 attempts to queue BO again, which
does happen, the BO will be added to the submit list twice. The Linux
kernel driver correctly detects this and warns about it with "BO at
index %u already on submit list" kernel message.

However, when cleaning the BO cache in etna_bo_cache_free(), the BO
which was submitted twice will also be free()d twice, this triggering
a glibc double free detector.

The fix is easy, even if the BO does not have current_stream set,
iterate over current streams' list of BOs before adding the BO to it
and verify that the BO is not yet there.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Christian Gmeiner <christian.gmeiner@gmail.com>
Cc: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Wladimir J. van der Laan <laanwj@gmail.com>
2019-06-28 16:17:19 +02:00
..
Android.mk android: introduce Android.common.mk to reduce boilerplate 2017-01-27 15:48:16 +00:00
Makefile.am automake: set NM before running the tests 2018-10-04 14:39:06 +01:00
Makefile.sources etnaviv: add permon support 2017-12-15 19:09:51 +01:00
etnaviv-symbol-check etnaviv: drop etna_bo_from_handle symbol 2019-06-24 16:21:07 +02:00
etnaviv_bo.c etnaviv: annotate public functions 2018-09-19 22:46:45 -07:00
etnaviv_bo_cache.c meson,configure: include config.h automatically 2018-03-20 18:19:26 +00:00
etnaviv_cmd_stream.c etnaviv: Fix double-free in etna_bo_cache_free() 2019-06-28 16:17:19 +02:00
etnaviv_device.c etnaviv: annotate public functions 2018-09-19 22:46:45 -07:00
etnaviv_drm.h headers: Sync with drm-next 2018-03-30 16:10:03 +01:00
etnaviv_drmif.h etnaviv: drop etna_bo_from_handle symbol 2019-06-24 16:21:07 +02:00
etnaviv_gpu.c etnaviv: annotate public functions 2018-09-19 22:46:45 -07:00
etnaviv_perfmon.c etnaviv: annotate public functions 2018-09-19 22:46:45 -07:00
etnaviv_pipe.c etnaviv: annotate public functions 2018-09-19 22:46:45 -07:00
etnaviv_priv.h fix various typos 2019-04-17 18:23:25 +01:00
libdrm_etnaviv.pc.in libdrm: add etnaviv drm support 2016-09-17 15:05:25 +02:00
meson.build meson: make symbols hidden by default 2018-09-19 22:46:45 -07:00