diff --git a/subsys/bluetooth/host/mesh/prov.c b/subsys/bluetooth/host/mesh/prov.c index c280233239e..9895c98d310 100644 --- a/subsys/bluetooth/host/mesh/prov.c +++ b/subsys/bluetooth/host/mesh/prov.c @@ -1195,12 +1195,6 @@ static void prov_msg_recv(void) BT_DBG("type 0x%02x len %u", type, link.rx.buf->len); - if (type != PROV_FAILED && type != link.expect) { - BT_WARN("Unexpected msg 0x%02x != 0x%02x", type, link.expect); - prov_send_fail_msg(PROV_ERR_UNEXP_PDU); - return; - } - if (!bt_mesh_fcs_check(link.rx.buf, link.rx.fcs)) { BT_ERR("Incorrect FCS"); return; @@ -1210,6 +1204,12 @@ static void prov_msg_recv(void) link.rx.prev_id = link.rx.id; link.rx.id = 0; + if (type != PROV_FAILED && type != link.expect) { + BT_WARN("Unexpected msg 0x%02x != 0x%02x", type, link.expect); + prov_send_fail_msg(PROV_ERR_UNEXP_PDU); + return; + } + if (type >= ARRAY_SIZE(prov_handlers)) { BT_ERR("Unknown provisioning PDU type 0x%02x", type); close_link(PROV_ERR_NVAL_PDU, CLOSE_REASON_FAILED);