Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion doc/releases/release-notes-3.6.rst
Original file line number Diff line number Diff line change
Expand Up @@ -272,9 +272,12 @@ Libraries / Subsystems
* Implemented datetime functionality in MCUmgr OS management group, this makes use of the RTC
driver API.

* Fixes an issue in MCUmgr console UART input whereby the FIFO would be read outside of an ISR,
* Fixed an issue in MCUmgr console UART input whereby the FIFO would be read outside of an ISR,
which is not supported in the next USB stack.

* Fixed an issue whereby the ``mcuboot erase`` DFU shell command could be used to erase the
MCUboot or currently running application slot.

* File systems

* Modem modules
Expand Down
16 changes: 16 additions & 0 deletions subsys/dfu/boot/mcuboot_shell.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2020 Grinn
* Copyright (c) 2023 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
Expand Down Expand Up @@ -91,6 +92,21 @@ static int cmd_mcuboot_erase(const struct shell *sh, size_t argc,

id = strtoul(argv[1], NULL, 0);

/* Check if this is the parent (MCUboot) or own slot and if so, deny the request */
#if FIXED_PARTITION_EXISTS(boot_partition)
if (id == FIXED_PARTITION_ID(boot_partition)) {
shell_error(sh, "Cannot erase boot partition");
return -EACCES;
}
#endif

#if DT_FIXED_PARTITION_EXISTS(DT_CHOSEN(zephyr_code_partition))
if (id == DT_FIXED_PARTITION_ID(DT_CHOSEN(zephyr_code_partition))) {
shell_error(sh, "Cannot erase active partitions");
return -EACCES;
}
#endif

err = boot_erase_img_bank(id);
if (err) {
shell_error(sh, "failed to erase bank %u", id);
Expand Down