Skip to content

Commit

Permalink
BUG/MAJOR: mux-quic: fix BUG_ON on empty STREAM emission
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
a-denoyelle committed Dec 31, 2024
1 parent 5bbdd14 commit 9806453
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/mux_quic.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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)
{
Expand Down

0 comments on commit 9806453

Please sign in to comment.