ID: 284 - Fix SEGV in ipmi_main

Check the return code of ipmi_main_intf->open(), and take the
error path if it fails. Right now we continue on blindly which
results in a SEGV.

Commit for Anton Blanchard
This commit is contained in:
Zdenek Styblik 2013-12-08 18:59:28 +00:00
parent 0b97d32c25
commit 5dc9585e77

View File

@ -894,9 +894,11 @@ ipmi_main(int argc, char ** argv,
/* Open the interface with the specified or default IPMB address */ /* Open the interface with the specified or default IPMB address */
ipmi_main_intf->my_addr = arg_addr ? arg_addr : IPMI_BMC_SLAVE_ADDR; ipmi_main_intf->my_addr = arg_addr ? arg_addr : IPMI_BMC_SLAVE_ADDR;
if (ipmi_main_intf->open != NULL) if (ipmi_main_intf->open != NULL) {
ipmi_main_intf->open(ipmi_main_intf); if (ipmi_main_intf->open(ipmi_main_intf) < 0) {
goto out_free;
}
}
/* /*
* Attempt picmg discovery of the actual interface address unless * Attempt picmg discovery of the actual interface address unless
* the users specified an address. * the users specified an address.