BUG/MINOR: mux-quic: prevent quic_conn error code to be overwritten

When MUX performs a graceful shutdown, quic_conn error code is set to a
"no error" code which depends on the application layer used. However,
this may overwrite a previous error code if quic_conn layer has detected
an error on its side.

In practice, this behavior has not been seen on production. In fact, it
may have undesirable effect only if this error code modification happens
between the quic_conn error detection and the emission of the
CONNECTION_CLOSE, so it should be pretty rare. However, there is still a
tiny possibility it may happen.

To prevent this, first check that quic_conn error code is not set before
setting it. Ideally, transport layer API should be adjusted to be able
to set this without fiddling with the quic_conn directly.

This should be backported up to 2.6.
This commit is contained in:
Amaury Denoyelle 2023-05-04 15:36:17 +02:00
parent 4403cdf653
commit b737f95009

View File

@ -851,8 +851,12 @@ void qcc_emit_cc_app(struct qcc *qcc, int err, int immediate)
tasklet_wakeup(qcc->wait_event.tasklet);
}
else {
/* Only register the error code for graceful shutdown. */
qcc->conn->handle.qc->err = quic_err_app(err);
/* Only register the error code for graceful shutdown.
* Do not overwrite quic-conn existing code if already set.
* TODO implement a wrapper function for this in quic-conn module
*/
if (!(qcc->conn->handle.qc->flags & QUIC_FL_CONN_IMMEDIATE_CLOSE))
qcc->conn->handle.qc->err = quic_err_app(err);
}
TRACE_LEAVE(QMUX_EV_QCC_END, qcc->conn);