]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MEDIUM: quic: fix crash on invalid qc_stream_buf_free() BUG_ON
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Mon, 29 Jan 2024 08:18:08 +0000 (09:18 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Mon, 29 Jan 2024 14:44:49 +0000 (15:44 +0100)
commita13989f109033e7139c58fdc78c35ef02576d788
treee3b01fb2264a045163be2b7ee280f748089643ed
parent7d22c4956c53895e5347d84d43f2a70cbdc01bef
BUG/MEDIUM: quic: fix crash on invalid qc_stream_buf_free() BUG_ON

A recent fix was introduced to ensure unsent data are deleted when a
QUIC MUX stream releases its qc_stream_desc instance. This is necessary
to ensure all used buffers will be liberated once all ACKs are received.
This is implemented by the following patch :

  commit ad6b13d3177945bf6a85d6dc5af80b8e34ea6191 (quic-dev/qns)
  BUG/MEDIUM: quic: remove unsent data from qc_stream_desc buf

Before this patch, buffer removal was done only on ACK reception. ACK
handling is only done in order from the oldest one. A BUG_ON() statement
is present to ensure this assertion remains valid.

This is however not true anymore since the above patch. Indeed, after
unsent data removal, the current buffer may be empty if it did not
contain yet any sent data. In this case, it is not the oldest buffer,
thus the BUG_ON() statement will be triggered.

To fix this, simply remove this BUG_ON() statement. It should not have
any impact as it is safe to remove buffers in any order.

Note that several conditions must be met to trigger this BUG_ON crash :
* a QUIC MUX stream is destroyed before transmitting all of its data
* several buffers must have been previously allocated for this stream so
  it happens only for transfers bigger than bufsize
* latency should be high enough to delay ACK reception

This must be backported wherever the above patch is (currently targetted
to 2.6).
src/quic_stream.c