BUG/MEDIUM: ring: write-lock the ring while attaching/detaching
authorWilly Tarreau <w@1wt.eu>
Tue, 19 May 2020 17:21:45 +0000 (19:21 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 19 May 2020 17:37:12 +0000 (19:37 +0200)
commit223ddedb467494d78ebf67e0ac19206f767ffe6a
treeaeeea4011d0fe678a83501a6726215c0c7b76c52
parentfe410d685ad8bce7399e50695098b69aea07e558
BUG/MEDIUM: ring: write-lock the ring while attaching/detaching

The LIST_ADDQ() and LIST_DEL_INIT() calls made to attach/detach a waiter
to the ring were made under a read lock which was sufficient in front of
the writer's write lock. But it's not sufficient against other readers!
Thus theorically multiple "show events" on the same ring buffer on the
CLI could result in a crash, even though for now I couldn't manage to
reproduce it.

This fixes commit 1d181e489c ("MEDIUM: ring: implement a wait mode for
watchers") so it must be backported to 2.1, possibly further if the ring
code gets backported.
src/ring.c