Skip to content

Commit 0d0fabd

Browse files
PavelVPVcvinayak
authored andcommitted
[nrf fromtree] Bluetooth: Mesh: Fix failing DFU/SR/FD/BV-08-C test
The `upload_status_rsp_with_progress` function uses the currently set slot pointer to set firmware id field in the message. If another upload starts but the firmware is already received, the slot API won't let us to set the fwid and will return an error code. In this case, the slot pointer stays invalid as fwid wasn't set, and `upload_status_rsp_with_progress` will not add fwid as the lenght is zero. Signed-off-by: Pavel Vasilyev <[email protected]> (cherry picked from commit 0af523e) Signed-off-by: Alperen Şener <[email protected]>
1 parent c60135a commit 0d0fabd

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

subsys/bluetooth/mesh/dfd_srv.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,12 +412,20 @@ static inline int set_upload_fwid(struct bt_mesh_dfd_srv *srv, struct bt_mesh_ms
412412
case -EFBIG: /* Fwid too long */
413413
case -EALREADY: /* Other server is in progress with this fwid */
414414
bt_mesh_dfu_slot_release(srv->upload.slot);
415+
srv->upload.slot = NULL;
415416
upload_status_rsp(srv, ctx, BT_MESH_DFD_ERR_INTERNAL);
416417
break;
417418
case -EEXIST: /* Img with this fwid already is in list */
418419
srv->upload.phase = BT_MESH_DFD_UPLOAD_PHASE_TRANSFER_SUCCESS;
419420
bt_mesh_dfu_slot_release(srv->upload.slot);
420-
upload_status_rsp_with_progress(srv, ctx, BT_MESH_DFD_SUCCESS, 100);
421+
422+
err = bt_mesh_dfu_slot_get(fwid, fwid_len, &srv->upload.slot);
423+
if (!err) {
424+
upload_status_rsp_with_progress(srv, ctx, BT_MESH_DFD_SUCCESS, 100);
425+
} else {
426+
srv->upload.slot = NULL;
427+
upload_status_rsp(srv, ctx, BT_MESH_DFD_ERR_INTERNAL);
428+
}
421429
break;
422430
case 0:
423431
srv->upload.phase = BT_MESH_DFD_UPLOAD_PHASE_TRANSFER_ACTIVE;

0 commit comments

Comments
 (0)