From 9f073021da857d262285f9891d19f709225c30bd Mon Sep 17 00:00:00 2001 From: wangjialiang Date: Thu, 4 Mar 2021 15:27:21 +0800 Subject: [PATCH] ble_mesh: stack: Fix PB-GATT not check invalid link flag For case MESH/NODE/PROV/BI-03-C --- components/bt/esp_ble_mesh/mesh_core/prov.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/components/bt/esp_ble_mesh/mesh_core/prov.c b/components/bt/esp_ble_mesh/mesh_core/prov.c index f0ffa4749b..760c07d9c2 100644 --- a/components/bt/esp_ble_mesh/mesh_core/prov.c +++ b/components/bt/esp_ble_mesh/mesh_core/prov.c @@ -1670,6 +1670,16 @@ int bt_mesh_pb_gatt_recv(struct bt_mesh_conn *conn, struct net_buf_simple *buf) return -EINVAL; } + /* For case MESH/NODE/PROV/BI-03-C, if the link is closed, when the node receive + * a Provisioning PDU , it will send a Provisioning Failed PDU with the Error Code + * field set to Unexpected PDU(0x03). + */ + if (bt_mesh_atomic_test_bit(link.flags, LINK_INVALID)) { + BT_WARN("Unexpected msg 0x%02x on invalid link", type); + prov_send_fail_msg(PROV_ERR_UNEXP_PDU); + return -EINVAL; + } + /* For case MESH/NODE/PROV/BI-15-C, when the node receive a Provisioning PDU * with the Type field set to the lowest unsupported or RFU value, it sends a * Provisioning Failed PDU with the Error Code field set to Invalid PDU(0x01).