Skip to content

Commit 5328adc

Browse files
anchaojhedberg
authored andcommitted
Bluetooth: Mesh: Fix tx seg buffer with NULL pointer reference
Fix tx seg buffer with NULL pointer reference if enable mesh friendly Signed-off-by: chao an <anchao@xiaomi.com>
1 parent 6c7a387 commit 5328adc

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

subsys/bluetooth/mesh/transport.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,8 @@ static int send_seg(struct bt_mesh_net_tx *net_tx, struct net_buf_simple *sdu,
532532

533533
BT_DBG("seg %u: %s", seg_o, bt_hex(buf, len));
534534

535+
tx->seg[seg_o] = buf;
536+
535537
if (IS_ENABLED(CONFIG_BT_MESH_FRIEND)) {
536538
enum bt_mesh_friend_pdu_type type;
537539

@@ -552,11 +554,11 @@ static int send_seg(struct bt_mesh_net_tx *net_tx, struct net_buf_simple *sdu,
552554
* out through the Friend Queue.
553555
*/
554556
k_mem_slab_free(&segs, &buf);
555-
continue;
557+
tx->seg[seg_o] = NULL;
556558
}
559+
557560
}
558561

559-
tx->seg[seg_o] = buf;
560562
}
561563

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

0 commit comments

Comments
 (0)