From 9cbb979db79c66cb4010ef80bbff32b3af41b97f Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Sun, 12 Nov 2017 21:38:21 +0200 Subject: [PATCH] Bluetooth: Mesh: Fix sending messages when not provisioned The message sending APIs should fail cleanly if we are not yet provisioned. Signed-off-by: Johan Hedberg --- subsys/bluetooth/host/mesh/access.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/subsys/bluetooth/host/mesh/access.c b/subsys/bluetooth/host/mesh/access.c index 082db51dc8a..1c13b8320eb 100644 --- a/subsys/bluetooth/host/mesh/access.c +++ b/subsys/bluetooth/host/mesh/access.c @@ -454,6 +454,11 @@ static int model_send(struct bt_mesh_model *model, ctx->app_idx, ctx->addr); BT_DBG("len %u: %s", msg->len, bt_hex(msg->data, msg->len)); + if (!bt_mesh_is_provisioned()) { + BT_ERR("Local node is not yet provisioned"); + return -EAGAIN; + } + if (net_buf_simple_tailroom(msg) < 4) { BT_ERR("Not enough tailroom for TransMIC"); return -EINVAL;