aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Piggin <npiggin@gmail.com>2025-04-02 00:01:52 +1000
committerCorey Minyard <corey@minyard.net>2025-04-11 10:50:43 -0500
commitdacb3e70ef73d1c9a2d0d4cfd65031deff49f742 (patch)
treee5663bff344d2d021fad17b26ae581bff2d894b3
parentd9494ef96c859515aa9df450fb61e833da7cb7c7 (diff)
downloadqemu-dacb3e70ef73d1c9a2d0d4cfd65031deff49f742.zip
qemu-dacb3e70ef73d1c9a2d0d4cfd65031deff49f742.tar.gz
qemu-dacb3e70ef73d1c9a2d0d4cfd65031deff49f742.tar.bz2
ipmi/bmc-sim: add error handling for 'Set BMC Global Enables' command
Mask out unsupported bits and return failure if attempting to set any. This is not required by the IPMI spec, but it does require that system software not change bits it isn't aware of. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Message-ID: <20250401140153.685523-6-npiggin@gmail.com> Signed-off-by: Corey Minyard <corey@minyard.net>
-rw-r--r--hw/ipmi/ipmi_bmc_sim.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/hw/ipmi/ipmi_bmc_sim.c b/hw/ipmi/ipmi_bmc_sim.c
index 4ed66e1..1c60a71 100644
--- a/hw/ipmi/ipmi_bmc_sim.c
+++ b/hw/ipmi/ipmi_bmc_sim.c
@@ -235,6 +235,7 @@ struct IPMIBmcSim {
#define IPMI_BMC_MSG_FLAG_RCV_MSG_QUEUE_SET(s) \
(IPMI_BMC_MSG_FLAG_RCV_MSG_QUEUE & (s)->msg_flags)
+#define IPMI_BMC_GLOBAL_ENABLES_SUPPORTED 0x0f
#define IPMI_BMC_RCV_MSG_QUEUE_INT_BIT 0
#define IPMI_BMC_EVBUF_FULL_INT_BIT 1
#define IPMI_BMC_EVENT_MSG_BUF_BIT 2
@@ -934,7 +935,14 @@ static void set_bmc_global_enables(IPMIBmcSim *ibs,
uint8_t *cmd, unsigned int cmd_len,
RspBuffer *rsp)
{
- set_global_enables(ibs, cmd[2]);
+ uint8_t val = cmd[2];
+
+ if (val & ~IPMI_BMC_GLOBAL_ENABLES_SUPPORTED) {
+ rsp_buffer_set_error(rsp, IPMI_CC_INVALID_DATA_FIELD);
+ return;
+ }
+
+ set_global_enables(ibs, val);
}
static void get_bmc_global_enables(IPMIBmcSim *ibs,