BUG/MAJOR: mux-quic: fix BUG_ON on empty STREAM emission

A BUG_ON() is present in qcc_io_send() to ensure that encoded frame list
is empty if qcc_build_frms() previously returned 0.

This BUG_ON() may be triggered if empty STREAM frame is encoded for
standalone FIN. Indeed, qcc_build_frms() returns the sum of all STREAM
payload length. In case only empty STREAM frames are generated, return
value will be 0, despite new frames encoded and inserted into frame
list.

To fix this, change return value of qcs_send(). This now returns the
whole STREAM frame length, both header and payload included. This
ensures that qcc_build_frms() won't return a nul value if new frames are
encoded, even empty ones.

This must be backported up to 3.1.
This commit is contained in:
Amaury Denoyelle 2024-12-31 15:21:19 +01:00
parent 5bbdd14f56
commit 9806453742

View File

@ -2014,7 +2014,7 @@ static void qcs_destroy(struct qcs *qcs)
* truncated if greater than <fc_conn_wnd>. This allows to prepare several
* frames in a loop while respecting connection flow control window.
*
* Returns the payload length of the STREAM frame or a negative error code.
* Returns the length of the STREAM frame or a negative error code.
*/
static int qcs_build_stream_frm(struct qcs *qcs, struct buffer *out, char fin,
struct list *frm_list, uint64_t window_conn)
@ -2103,7 +2103,7 @@ static int qcs_build_stream_frm(struct qcs *qcs, struct buffer *out, char fin,
qcc->conn, qcs, &arg);
}
return total;
return qc_frm_len(frm);
err:
TRACE_LEAVE(QMUX_EV_QCS_SEND, qcc->conn, qcs);
@ -2265,7 +2265,7 @@ static int qcs_send_stop_sending(struct qcs *qcs)
* This allows to prepare several frames in a loop while respecting connection
* flow control window.
*
* Returns the payload length of the STREAM frame or a negative error code.
* Returns the length of the STREAM frame or a negative error code.
*/
static int qcs_send(struct qcs *qcs, struct list *frms, uint64_t window_conn)
{