hw/ipmi: reject NULL 'bmc' property rather than crash
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Marc-André Lureau committed
May 3, 2026 at 11:53 UTC
d36cf704a23c3c00db2209f731e636e768917909
1 file changed
+7
-1
hw/ipmi/ipmi.c
+7
-1
@@ -97,8 +97,14 @@ static void isa_ipmi_bmc_check(const Object *obj, const char *name,
97
{
98
IPMIBmc *bmc = IPMI_BMC(val);
99
100
- if (bmc->intf)
100
+ if (!bmc) {
101
+ error_setg(errp, "%s cannot be set to NULL", name);
102
+ return;
103
+ }
104
+
105
+ if (bmc->intf) {
106
error_setg(errp, "BMC object is already in use");
107
+ }
108
}
109
110
void ipmi_bmc_find_and_link(Object *obj, Object **bmc)