mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 06:11:32 +02:00
BUG/MINOR: mux-quic: handle properly recv ncbuf alloc failure
The function qc_get_ncbuf() is used to allocate a ncbuf content. Allocation failure was handled using a plain BUG_ON. Fix this by a proper error management. This buffer is only used for STREAM frame reception to support out-of-order offsets. When an allocation failed, close the connection with a QUIC internal error code. This should be backported up to 2.6.
This commit is contained in:
parent
0abde9dee6
commit
d00b3093c9
@ -426,13 +426,17 @@ struct buffer *qc_get_buf(struct qcs *qcs, struct buffer *bptr)
|
|||||||
return b_alloc(bptr);
|
return b_alloc(bptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Allocate if needed buffer <ncbuf> for stream <qcs>.
|
||||||
|
*
|
||||||
|
* Returns the buffer instance or NULL on allocation failure.
|
||||||
|
*/
|
||||||
static struct ncbuf *qc_get_ncbuf(struct qcs *qcs, struct ncbuf *ncbuf)
|
static struct ncbuf *qc_get_ncbuf(struct qcs *qcs, struct ncbuf *ncbuf)
|
||||||
{
|
{
|
||||||
struct buffer buf = BUF_NULL;
|
struct buffer buf = BUF_NULL;
|
||||||
|
|
||||||
if (ncb_is_null(ncbuf)) {
|
if (ncb_is_null(ncbuf)) {
|
||||||
b_alloc(&buf);
|
if (!b_alloc(&buf))
|
||||||
BUG_ON(b_is_null(&buf));
|
return NULL;
|
||||||
|
|
||||||
*ncbuf = ncb_make(buf.area, buf.size, 0);
|
*ncbuf = ncb_make(buf.area, buf.size, 0);
|
||||||
ncb_init(ncbuf, 0);
|
ncb_init(ncbuf, 0);
|
||||||
@ -1043,9 +1047,9 @@ int qcc_recv(struct qcc *qcc, uint64_t id, uint64_t len, uint64_t offset,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!qc_get_ncbuf(qcs, &qcs->rx.ncbuf) || ncb_is_null(&qcs->rx.ncbuf)) {
|
if (!qc_get_ncbuf(qcs, &qcs->rx.ncbuf) || ncb_is_null(&qcs->rx.ncbuf)) {
|
||||||
/* TODO should mark qcs as full */
|
TRACE_ERROR("receive ncbuf alloc failure", QMUX_EV_QCC_RECV|QMUX_EV_QCS_RECV, qcc->conn, qcs);
|
||||||
ABORT_NOW();
|
qcc_set_error(qcc, QC_ERR_INTERNAL_ERROR, 0);
|
||||||
return 1;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE_DATA("newly received offset", QMUX_EV_QCC_RECV|QMUX_EV_QCS_RECV, qcc->conn, qcs);
|
TRACE_DATA("newly received offset", QMUX_EV_QCC_RECV|QMUX_EV_QCS_RECV, qcc->conn, qcs);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user