Skip to content

Commit 26e335c

Browse files
cvinayaknashif
authored andcommitted
Bluetooth: controller: Fix data length update procedure checks
Fix data legnth update procedure to check transaction violations. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
1 parent 871ab25 commit 26e335c

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

subsys/bluetooth/controller/ll_sw/ull_conn.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4885,9 +4885,12 @@ static inline int length_req_rsp_recv(struct ll_conn *conn, memq_link_t *link,
48854885

48864886
/* Check for free ctrl tx PDU */
48874887
if (pdu_rx->llctrl.opcode == PDU_DATA_LLCTRL_TYPE_LENGTH_REQ) {
4888-
tx = mem_acquire(&mem_conn_tx_ctrl.free);
4888+
int err;
4889+
4890+
/* Check transaction violation and get free ctrl tx PDU */
4891+
tx = ctrl_tx_rsp_mem_acquire(conn, *rx, &err);
48894892
if (!tx) {
4890-
return -ENOBUFS;
4893+
return err;
48914894
}
48924895
}
48934896

@@ -5085,6 +5088,11 @@ static inline int length_req_rsp_recv(struct ll_conn *conn, memq_link_t *link,
50855088
if (pdu_rx->llctrl.opcode != PDU_DATA_LLCTRL_TYPE_LENGTH_RSP) {
50865089
mem_release(tx, &mem_conn_tx_ctrl.free);
50875090

5091+
/* Release the transacation lock, as ctrl tx PDU is not
5092+
* being enqueued.
5093+
*/
5094+
conn->common.txn_lock = 0U;
5095+
50885096
/* Defer new request if previous in resize state */
50895097
if (conn->llcp_length.state ==
50905098
LLCP_LENGTH_STATE_RESIZE) {
@@ -5458,6 +5466,9 @@ static inline void ctrl_tx_ack(struct ll_conn *conn, struct node_tx **tx,
54585466
break;
54595467

54605468
case PDU_DATA_LLCTRL_TYPE_LENGTH_RSP:
5469+
/* Reset the transaction lock */
5470+
conn->common.txn_lock = 0U;
5471+
54615472
if (conn->llcp_length.req != conn->llcp_length.ack) {
54625473
switch (conn->llcp_length.state) {
54635474
case LLCP_LENGTH_STATE_RSP_ACK_WAIT:

0 commit comments

Comments
 (0)