Commit b6778a35 authored by Mario Limonciello's avatar Mario Limonciello
Browse files

dell: fix crashes when enumerating with dock connected but UEFI capsule off

Crashes will happen when UEFI capsule is turned off due to fwupdate
trying to do a SMI request that invalidates the buffer used by fwupd.

This is due to both fwupdate and fwupd using libsmbios in the same process.
Fixes: https://bugs.launchpad.net/ubuntu/+source/fwupd/+bug/1726367
parent ea8a7d7a
......@@ -195,25 +195,8 @@ static gboolean
fu_plugin_dell_capsule_supported (FuPlugin *plugin)
{
FuPluginData *data = fu_plugin_get_data (plugin);
gint uefi_supported;
if (data->smi_obj->fake_smbios)
return TRUE;
/* If ESRT is not turned on, fwupd will have already created an
* unlock device (if compiled with support).
*
* Once unlocked, that will enable flashing capsules here too.
*
* that means we should only look for supported = 1
*/
uefi_supported = fwup_supported ();
if (uefi_supported != 1) {
g_debug ("UEFI capsule firmware updating not supported (%x)",
(guint) uefi_supported);
return FALSE;
}
return TRUE;
return data->smi_obj->fake_smbios || data->capsule_supported;
}
static gboolean
......@@ -886,6 +869,7 @@ fu_plugin_startup (FuPlugin *plugin, GError **error)
{
FuPluginData *data = fu_plugin_get_data (plugin);
GUsbContext *usb_ctx = fu_plugin_get_usb_context (plugin);
gint uefi_supported;
if (data->smi_obj->fake_smbios) {
g_debug ("Called with fake SMBIOS implementation. "
......@@ -902,6 +886,20 @@ fu_plugin_startup (FuPlugin *plugin, GError **error)
return FALSE;
}
/* If ESRT is not turned on, fwupd will have already created an
* unlock device (if compiled with support).
*
* Once unlocked, that will enable flashing capsules here too.
*
* that means we should only look for supported = 1
*/
uefi_supported = fwup_supported ();
data->capsule_supported = (uefi_supported == 1);
if (!data->capsule_supported) {
g_debug ("UEFI capsule firmware updating not supported (%x)",
(guint) uefi_supported);
}
if (usb_ctx != NULL) {
g_signal_connect (usb_ctx, "device-added",
G_CALLBACK (fu_plugin_dell_device_added_cb),
......
......@@ -31,6 +31,7 @@ struct FuPluginData {
guint16 fake_vid;
guint16 fake_pid;
gboolean can_switch_modes;
gboolean capsule_supported;
};
void
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment