Skip to content

Commit 0ad84d0

Browse files
committed
mesh: Fix tx seg buffer with NULL pointer reference
Bluetooth: Mesh: Fix tx seg buffer with NULL pointer reference Fix tx seg buffer with NULL pointer reference if enable mesh friendly this is port of zephyrproject-rtos/zephyr#27251
1 parent 05c1e27 commit 0ad84d0

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

nimble/host/mesh/src/transport.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,8 @@ static int send_seg(struct bt_mesh_net_tx *net_tx, struct os_mbuf *sdu,
530530
memcpy(buf, net_buf_simple_pull_mem(sdu, len), len);
531531
BT_DBG("seg %u: %s", seg_o, bt_hex(buf, len));
532532

533+
tx->seg[seg_o] = buf;
534+
533535
if (IS_ENABLED(CONFIG_BT_MESH_FRIEND)) {
534536
enum bt_mesh_friend_pdu_type type;
535537

@@ -550,11 +552,10 @@ static int send_seg(struct bt_mesh_net_tx *net_tx, struct os_mbuf *sdu,
550552
* out through the Friend Queue.
551553
*/
552554
k_mem_slab_free(&segs, &buf);
553-
continue;
555+
tx->seg[seg_o] = NULL;
554556
}
555557
}
556558

557-
tx->seg[seg_o] = buf;
558559
}
559560

560561
/* This can happen if segments only went into the Friend Queue */

0 commit comments

Comments
 (0)