[PATCH 7/7] lib: sbi: dbtr: reject a chain in the last entry of INSTALL
Heinrich Schuchardt
heinrich.schuchardt at canonical.com
Fri Nov 20 15:11:19 PST 2026
The specification says that the last trigger configuration in the shared
memory must not have trig_tdata1.chain == 1 for the types mcontrol and
mcontrol6, to prevent an incomplete trigger configuration chain. It names
no error code. SBI_ERR_INVALID_PARAM is the one for an invalid
trig_tdata1.
sbi_dbtr_install_trig() accepted such a configuration and installed a
chain whose last trigger points to a trigger that is not part of it.
Check the last entry together with the other configuration checks. The
check runs before any trigger is installed, so a rejected request installs
nothing, and sbiret.value is the array index of the last entry.
The chain field is only read for mcontrol and mcontrol6, as for the update
function. Other types use the bit for something else.
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
---
lib/sbi/sbi_dbtr.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/lib/sbi/sbi_dbtr.c b/lib/sbi/sbi_dbtr.c
index a6b860da..f60cce7b 100644
--- a/lib/sbi/sbi_dbtr.c
+++ b/lib/sbi/sbi_dbtr.c
@@ -805,6 +805,13 @@ int sbi_dbtr_install_trig(unsigned long smode,
rc = dbtr_check_trigger_config(hs, NULL, recv,
tdata2_impl, tdata3_impl);
+ /*
+ * A chain has to be completed by the next configuration, so
+ * the last configuration must not continue it.
+ */
+ if (!rc && _idx + 1 == trig_count &&
+ dbtr_tdata1_chain(lle_to_cpu(recv->tdata1)))
+ rc = SBI_ERR_INVALID_PARAM;
if (rc) {
*out = _idx;
sbi_hart_protection_temp_unmap_range((unsigned long)shmem_base,
--
2.53.0
More information about the opensbi
mailing list