From 7ac418187369487f6fa633dab6d6c0a99913f479 Mon Sep 17 00:00:00 2001 From: Omkar Kulkarni Date: Mon, 23 Oct 2023 14:07:48 +0200 Subject: [PATCH] [nrf fromlist] Bluetooth: Mesh: FU Server should not update internal state on error According to conditions in the DFU spec section 6.1.3.7 (Sending a Firmware Update Status message) and in 'Idempotency' part of section 6.1.3.4 (Receiving a Firmware Update Start message), the FU Server should not update internal state when 'Wrong Phase' error condition is triggered. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/64258 Signed-off-by: Omkar Kulkarni (cherry picked from commit b4eef4da68a5c1f4b02c4d10ee0340375f775a14) --- subsys/bluetooth/mesh/dfu_srv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/subsys/bluetooth/mesh/dfu_srv.c b/subsys/bluetooth/mesh/dfu_srv.c index 282a40074c9..462a777b46c 100644 --- a/subsys/bluetooth/mesh/dfu_srv.c +++ b/subsys/bluetooth/mesh/dfu_srv.c @@ -302,10 +302,10 @@ static int handle_start(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx, status = BT_MESH_DFU_ERR_WRONG_PHASE; } else { status = BT_MESH_DFU_SUCCESS; + srv->update.ttl = ttl; + srv->blob.state.xfer.id = blob_id; } - srv->update.ttl = ttl; - srv->blob.state.xfer.id = blob_id; LOG_WRN("Busy. Phase: %u", srv->update.phase); goto rsp; }