diff options
Diffstat (limited to 'meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager')
4 files changed, 720 insertions, 3 deletions
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0001-Add-more-error-types.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0001-Add-more-error-types.patch new file mode 100644 index 000000000..d43256bf4 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0001-Add-more-error-types.patch @@ -0,0 +1,459 @@ +From e710df3123c382fc735c451a048f7c51250c1a92 Mon Sep 17 00:00:00 2001 +From: James Feist <james.feist@linux.intel.com> +Date: Thu, 11 Jun 2020 13:14:11 -0700 +Subject: [PATCH 1/2] Add more error types + +This adds ImageFailure and Busy error types +to updates status in bmcweb. + +elog-errors.hpp is a generated file. + +Tested: Could create errors + +Signed-off-by: James Feist <james.feist@linux.intel.com> +--- + elog-errors.hpp | 269 ++++++++++++------ + .../Software/Image.errors.yaml | 5 + + .../Software/Image.metadata.yaml | 11 + + 3 files changed, 204 insertions(+), 81 deletions(-) + +diff --git a/elog-errors.hpp b/elog-errors.hpp +index 2888f0d..38016e1 100644 +--- a/elog-errors.hpp ++++ b/elog-errors.hpp +@@ -2,12 +2,12 @@ + // See elog-gen.py for more details + #pragma once + +-#include <phosphor-logging/elog.hpp> +-#include <phosphor-logging/log.hpp> +-#include <sdbusplus/exception.hpp> + #include <string> + #include <tuple> + #include <type_traits> ++#include <sdbusplus/exception.hpp> ++#include <phosphor-logging/log.hpp> ++#include <phosphor-logging/elog.hpp> + + namespace sdbusplus + { +@@ -21,7 +21,7 @@ namespace Image + { + namespace Error + { +-struct UnTarFailure; ++ struct InternalFailure; + } // namespace Error + } // namespace Image + } // namespace Software +@@ -41,7 +41,7 @@ namespace Image + { + namespace Error + { +-struct InternalFailure; ++ struct UnTarFailure; + } // namespace Error + } // namespace Image + } // namespace Software +@@ -61,7 +61,7 @@ namespace Image + { + namespace Error + { +-struct ManifestFileFailure; ++ struct BusyFailure; + } // namespace Error + } // namespace Image + } // namespace Software +@@ -69,6 +69,47 @@ struct ManifestFileFailure; + } // namespace xyz + } // namespace sdbusplus + ++namespace sdbusplus ++{ ++namespace xyz ++{ ++namespace openbmc_project ++{ ++namespace Software ++{ ++namespace Image ++{ ++namespace Error ++{ ++ struct ImageFailure; ++} // namespace Error ++} // namespace Image ++} // namespace Software ++} // namespace openbmc_project ++} // namespace xyz ++} // namespace sdbusplus ++ ++namespace sdbusplus ++{ ++namespace xyz ++{ ++namespace openbmc_project ++{ ++namespace Software ++{ ++namespace Image ++{ ++namespace Error ++{ ++ struct ManifestFileFailure; ++} // namespace Error ++} // namespace Image ++} // namespace Software ++} // namespace openbmc_project ++} // namespace xyz ++} // namespace sdbusplus ++ ++ + namespace phosphor + { + +@@ -88,38 +129,25 @@ namespace _UnTarFailure + + struct PATH + { +- static constexpr auto str = "PATH=%s"; ++ /* ++ * We can't use -fsanitize=undefined if we declare a ++ * 'static constexpr auto str' member, so don't. Instead, open-code the ++ * mako template lookups. ++ */ + static constexpr auto str_short = "PATH"; +- using type = std::tuple<std::decay_t<decltype(str)>, const char*>; +- explicit constexpr PATH(const char* a) : _entry(entry(str, a)){}; ++ using type = std::tuple<std::decay_t<decltype("PATH=%s")>,const char*>; ++ explicit constexpr PATH(const char* a) : _entry(entry("PATH=%s", a)) {}; + type _entry; + }; + +-} // namespace _UnTarFailure ++} // namespace _UnTarFailure + +-struct UnTarFailure : public sdbusplus::exception_t ++struct UnTarFailure + { +- static constexpr auto errName = +- "xyz.openbmc_project.Software.Image.UnTarFailure"; +- static constexpr auto errDesc = "An error occurred during untar."; + static constexpr auto L = level::ERR; + using PATH = _UnTarFailure::PATH; + using metadata_types = std::tuple<PATH>; + +- const char* name() const noexcept +- { +- return errName; +- } +- +- const char* description() const noexcept +- { +- return errDesc; +- } +- +- const char* what() const noexcept +- { +- return errName; +- } + }; + + } // namespace Image +@@ -127,16 +155,17 @@ struct UnTarFailure : public sdbusplus::exception_t + } // namespace openbmc_project + } // namespace xyz + ++ + namespace details + { + + template <> +-struct map_exception_type< +- sdbusplus::xyz::openbmc_project::Software::Image::Error::UnTarFailure> ++struct map_exception_type<sdbusplus::xyz::openbmc_project::Software::Image::Error::UnTarFailure> + { + using type = xyz::openbmc_project::Software::Image::UnTarFailure; + }; +-} // namespace details ++ ++} + + namespace xyz + { +@@ -151,38 +180,25 @@ namespace _ManifestFileFailure + + struct PATH + { +- static constexpr auto str = "PATH=%s"; ++ /* ++ * We can't use -fsanitize=undefined if we declare a ++ * 'static constexpr auto str' member, so don't. Instead, open-code the ++ * mako template lookups. ++ */ + static constexpr auto str_short = "PATH"; +- using type = std::tuple<std::decay_t<decltype(str)>, const char*>; +- explicit constexpr PATH(const char* a) : _entry(entry(str, a)){}; ++ using type = std::tuple<std::decay_t<decltype("PATH=%s")>,const char*>; ++ explicit constexpr PATH(const char* a) : _entry(entry("PATH=%s", a)) {}; + type _entry; + }; + +-} // namespace _ManifestFileFailure ++} // namespace _ManifestFileFailure + +-struct ManifestFileFailure : public sdbusplus::exception_t ++struct ManifestFileFailure + { +- static constexpr auto errName = +- "xyz.openbmc_project.Software.Image.ManifestFileFailure"; +- static constexpr auto errDesc = "An error when reading the Manifest file."; + static constexpr auto L = level::ERR; + using PATH = _ManifestFileFailure::PATH; + using metadata_types = std::tuple<PATH>; + +- const char* name() const noexcept +- { +- return errName; +- } +- +- const char* description() const noexcept +- { +- return errDesc; +- } +- +- const char* what() const noexcept +- { +- return errName; +- } + }; + + } // namespace Image +@@ -190,16 +206,17 @@ struct ManifestFileFailure : public sdbusplus::exception_t + } // namespace openbmc_project + } // namespace xyz + ++ + namespace details + { + + template <> +-struct map_exception_type<sdbusplus::xyz::openbmc_project::Software::Image:: +- Error::ManifestFileFailure> ++struct map_exception_type<sdbusplus::xyz::openbmc_project::Software::Image::Error::ManifestFileFailure> + { + using type = xyz::openbmc_project::Software::Image::ManifestFileFailure; + }; +-} // namespace details ++ ++} + + namespace xyz + { +@@ -214,39 +231,76 @@ namespace _InternalFailure + + struct FAIL + { +- static constexpr auto str = "FAIL=%s"; ++ /* ++ * We can't use -fsanitize=undefined if we declare a ++ * 'static constexpr auto str' member, so don't. Instead, open-code the ++ * mako template lookups. ++ */ + static constexpr auto str_short = "FAIL"; +- using type = std::tuple<std::decay_t<decltype(str)>, const char*>; +- explicit constexpr FAIL(const char* a) : _entry(entry(str, a)){}; ++ using type = std::tuple<std::decay_t<decltype("FAIL=%s")>,const char*>; ++ explicit constexpr FAIL(const char* a) : _entry(entry("FAIL=%s", a)) {}; + type _entry; + }; + +-} // namespace _InternalFailure ++} // namespace _InternalFailure + +-struct InternalFailure : public sdbusplus::exception_t ++struct InternalFailure + { +- static constexpr auto errName = +- "xyz.openbmc_project.Software.Image.InternalFailure"; +- static constexpr auto errDesc = +- "The operation failed internally during processing the image."; + static constexpr auto L = level::ERR; + using FAIL = _InternalFailure::FAIL; + using metadata_types = std::tuple<FAIL>; + +- const char* name() const noexcept +- { +- return errName; +- } ++}; ++ ++} // namespace Image ++} // namespace Software ++} // namespace openbmc_project ++} // namespace xyz ++ ++ ++namespace details ++{ ++ ++template <> ++struct map_exception_type<sdbusplus::xyz::openbmc_project::Software::Image::Error::InternalFailure> ++{ ++ using type = xyz::openbmc_project::Software::Image::InternalFailure; ++}; ++ ++} + +- const char* description() const noexcept +- { +- return errDesc; +- } ++namespace xyz ++{ ++namespace openbmc_project ++{ ++namespace Software ++{ ++namespace Image ++{ ++namespace _ImageFailure ++{ ++ ++struct PATH ++{ ++ /* ++ * We can't use -fsanitize=undefined if we declare a ++ * 'static constexpr auto str' member, so don't. Instead, open-code the ++ * mako template lookups. ++ */ ++ static constexpr auto str_short = "PATH"; ++ using type = std::tuple<std::decay_t<decltype("PATH=%s")>,const char*>; ++ explicit constexpr PATH(const char* a) : _entry(entry("PATH=%s", a)) {}; ++ type _entry; ++}; ++ ++} // namespace _ImageFailure ++ ++struct ImageFailure ++{ ++ static constexpr auto L = level::ERR; ++ using PATH = _ImageFailure::PATH; ++ using metadata_types = std::tuple<PATH>; + +- const char* what() const noexcept +- { +- return errName; +- } + }; + + } // namespace Image +@@ -254,16 +308,69 @@ struct InternalFailure : public sdbusplus::exception_t + } // namespace openbmc_project + } // namespace xyz + ++ + namespace details + { + + template <> +-struct map_exception_type< +- sdbusplus::xyz::openbmc_project::Software::Image::Error::InternalFailure> ++struct map_exception_type<sdbusplus::xyz::openbmc_project::Software::Image::Error::ImageFailure> + { +- using type = xyz::openbmc_project::Software::Image::InternalFailure; ++ using type = xyz::openbmc_project::Software::Image::ImageFailure; + }; +-} // namespace details ++ ++} ++ ++namespace xyz ++{ ++namespace openbmc_project ++{ ++namespace Software ++{ ++namespace Image ++{ ++namespace _BusyFailure ++{ ++ ++struct PATH ++{ ++ /* ++ * We can't use -fsanitize=undefined if we declare a ++ * 'static constexpr auto str' member, so don't. Instead, open-code the ++ * mako template lookups. ++ */ ++ static constexpr auto str_short = "PATH"; ++ using type = std::tuple<std::decay_t<decltype("PATH=%s")>,const char*>; ++ explicit constexpr PATH(const char* a) : _entry(entry("PATH=%s", a)) {}; ++ type _entry; ++}; ++ ++} // namespace _BusyFailure ++ ++struct BusyFailure ++{ ++ static constexpr auto L = level::ERR; ++ using PATH = _BusyFailure::PATH; ++ using metadata_types = std::tuple<PATH>; ++ ++}; ++ ++} // namespace Image ++} // namespace Software ++} // namespace openbmc_project ++} // namespace xyz ++ ++ ++namespace details ++{ ++ ++template <> ++struct map_exception_type<sdbusplus::xyz::openbmc_project::Software::Image::Error::BusyFailure> ++{ ++ using type = xyz::openbmc_project::Software::Image::BusyFailure; ++}; ++ ++} ++ + + } // namespace logging + +diff --git a/xyz/openbmc_project/Software/Image.errors.yaml b/xyz/openbmc_project/Software/Image.errors.yaml +index 67d6c20..2b8f7ee 100644 +--- a/xyz/openbmc_project/Software/Image.errors.yaml ++++ b/xyz/openbmc_project/Software/Image.errors.yaml +@@ -4,3 +4,8 @@ + description: An error when reading the Manifest file. + - name: InternalFailure + description: The operation failed internally during processing the image. ++- name: ImageFailure ++ description: An error occured processing the image. ++- name: BusyFailure ++ description: The device is busy during the update. ++ +diff --git a/xyz/openbmc_project/Software/Image.metadata.yaml b/xyz/openbmc_project/Software/Image.metadata.yaml +index 5e749c9..65d4e1c 100644 +--- a/xyz/openbmc_project/Software/Image.metadata.yaml ++++ b/xyz/openbmc_project/Software/Image.metadata.yaml +@@ -13,3 +13,14 @@ + meta: + - str: "FAIL=%s" + type: string ++- name: ImageFailure ++ level: ERR ++ meta: ++ - str: "PATH=%s" ++ type: string ++- name: BusyFailure ++ level: ERR ++ meta: ++ - str: "PATH=%s" ++ type: string ++ +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0008-PFR-image-HASH-verification.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0008-PFR-image-HASH-verification.patch index 31373104f..c65f8318c 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0008-PFR-image-HASH-verification.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0008-PFR-image-HASH-verification.patch @@ -8,11 +8,43 @@ firmware updates Tested: tested firmware update with good and bad HASH images. +A) +1. Upload the corrupted image for fw update. +2. Image present in /tmp/images/ +-rw-r--r-- 1 root root 22969344 Jun 3 09:27 +5dea710b-8b85-4065-8af7-3149ada81edf + +3. Journalctl logs during image verification +Jun 03 09:27:20 intel-obmc phosphor-version-software-manager[4755]: +Firmware image HASH verification failed +Jun 03 09:27:20 intel-obmc phosphor-version-software-manager[4755]: +Error verifying uploaded image +Jun 03 09:27:20 intel-obmc phosphor-version-software-manager[4755]: +Error processing image + +4. image deleted from /tmp/images/ + +B) +1. Upload the correct image. +POST: https://<BMC_IP>/redfish/v1/UpdateService/ + with <BMC_signed_cap> binary file +2. Image verification is success and proceeds with update. +{ + "@odata.id": "/redfish/v1/TaskService/Tasks/0", + "@odata.type": "#Task.v1_4_3.Task", + "Id": "0", + "TaskState": "Running", + "TaskStatus": "OK" +} + +Change-Id: I9336980bfb74c8136690024782bfef45f6b08d56 +Signed-off-by: Chalapathi Venkataramashetty <chalapathix.venkataramashetty@intel.com> + Signed-off-by: Vikram Bodireddy <vikram.bodireddy@linux.intel.com> --- - pfr_image_manager.cpp | 149 ++++++++++++++++++++++++++++++++---------- + pfr_image_manager.cpp | 150 +++++++++++++++++++++++++++++++++---------- pfr_image_manager.hpp | 112 +++++++++++++++++++++++++++++-- - 2 files changed, 221 insertions(+), 40 deletions(-) + 2 files changed, 222 insertions(+), 40 deletions(-) diff --git a/pfr_image_manager.cpp b/pfr_image_manager.cpp index 242a6ca..1a41cbe 100644 @@ -168,7 +200,7 @@ index 242a6ca..1a41cbe 100644 } catch (std::exception& e) { -@@ -79,20 +174,20 @@ static int getPFRImgInfo(const std::filesystem::path imgPath, uint8_t& imgType, +@@ -79,20 +174,21 @@ static int getPFRImgInfo(const std::filesystem::path imgPath, uint8_t& imgType, int Manager::processImage(const std::string& imgFilePath) { @@ -189,6 +221,7 @@ index 242a6ca..1a41cbe 100644 phosphor::logging::log<phosphor::logging::level::ERR>( - "Error reading uploaded image type and version"); + "Error verifying uploaded image"); ++ std::filesystem::remove_all(imgFilePath); return -1; } diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0010-Add-error-reporting-to-pfr_image_manager.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0010-Add-error-reporting-to-pfr_image_manager.patch new file mode 100644 index 000000000..9c3ab4dd2 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0010-Add-error-reporting-to-pfr_image_manager.patch @@ -0,0 +1,187 @@ +From ffa3642e436b559d8062f777f00458cc7b5ecb01 Mon Sep 17 00:00:00 2001 +From: James Feist <james.feist@linux.intel.com> +Date: Thu, 11 Jun 2020 13:30:02 -0700 +Subject: [PATCH 1/1] Add error reporting to pfr_image_manager + +This uses report functionality to update error +return status for redfish updates. + +Tested: Got 400 error with different messages based +on failure type + +{ + "error": { + "@Message.ExtendedInfo": [ + { + "@odata.type": "/redfish/v1/$metadata#Message.v1_0_0.Message", + "Message": "Invalid file uploaded to /redfish/v1/UpdateService: invalid archive.", + "MessageArgs": [ + "/redfish/v1/UpdateService", + "invalid archive" + ], + "MessageId": "OpenBMC.0.1.0.InvalidFile", + "Resolution": "None.", + "Severity": "Warning" + } + ], + "code": "OpenBMC.0.1.0.InvalidFile", + "message": "Invalid file uploaded to /redfish/v1/UpdateService: invalid archive." + } +} + +{ + "error": { + "@Message.ExtendedInfo": [ + { + "@odata.type": "/redfish/v1/$metadata#Message.v1_0_0.Message", + "Message": "Invalid file uploaded to /redfish/v1/UpdateService: invalid image format.", + "MessageArgs": [ + "/redfish/v1/UpdateService", + "invalid image format" + ], + "MessageId": "OpenBMC.0.1.0.InvalidFile", + "Resolution": "None.", + "Severity": "Warning" + } + ], + "code": "OpenBMC.0.1.0.InvalidFile", + "message": "Invalid file uploaded to /redfish/v1/UpdateService: invalid image format." + } +} + +{ + "error": { + "@Message.ExtendedInfo": [ + { + "@odata.type": "#Message.v1_0_0.Message", + "Message": "The resource /redfish/v1/UpdateService was unable to satisfy the request due to unavailability of resources.", + "MessageArgs": [ + "/redfish/v1/UpdateService" + ], + "MessageId": "Base.1.4.0.ResourceExhaustion", + "Resolution": "Ensure that the resources are available and resubmit the request.", + "Severity": "Critical" + } + ], + "code": "Base.1.4.0.ResourceExhaustion", + "message": "The resource /redfish/v1/UpdateService was unable to satisfy the request due to unavailability of resources." + } +} + +Signed-off-by: James Feist <james.feist@linux.intel.com> +--- + dbus_helpers.hpp | 30 ++++++++++++++++++++++++++++++ + pfr_image_manager.cpp | 18 ++++++++++++++++++ + 2 files changed, 48 insertions(+) + create mode 100644 dbus_helpers.hpp + +diff --git a/dbus_helpers.hpp b/dbus_helpers.hpp +new file mode 100644 +index 0000000..b9ffa36 +--- /dev/null ++++ b/dbus_helpers.hpp +@@ -0,0 +1,30 @@ ++#pragma once ++ ++#include "config.h" ++ ++#include <sdbusplus/bus.hpp> ++inline bool isFwupdScriptRunning(sdbusplus::bus::bus& bus) ++{ ++ using ObjectPath = sdbusplus::message::object_path; ++ // type is ssssssouso ++ using ListUnitsType = ++ std::tuple<std::string, std::string, std::string, std::string, ++ std::string, std::string, ObjectPath, uint32_t, std::string, ++ ObjectPath>; ++ auto method = bus.new_method_call(SYSTEMD_BUSNAME, SYSTEMD_PATH, ++ SYSTEMD_INTERFACE, "ListUnits"); ++ ++ auto reply = bus.call(method); ++ std::vector<ListUnitsType> resp; ++ reply.read(resp); ++ ++ for (const auto& unit : resp) ++ { ++ if (std::get<0>(unit).find("fwupd@") != std::string::npos && ++ std::get<3>(unit) != "failed") ++ { ++ return true; ++ } ++ } ++ return false; ++} +diff --git a/pfr_image_manager.cpp b/pfr_image_manager.cpp +index 1a41cbe..fe1e6f9 100644 +--- a/pfr_image_manager.cpp ++++ b/pfr_image_manager.cpp +@@ -2,6 +2,7 @@ + + #include "pfr_image_manager.hpp" + ++#include "dbus_helpers.hpp" + #include "version.hpp" + #include "watch.hpp" + +@@ -33,6 +34,9 @@ namespace manager + + using namespace sdbusplus::xyz::openbmc_project::Software::Image::Error; + namespace Software = phosphor::logging::xyz::openbmc_project::Software; ++using UnTarFail = Software::Image::UnTarFailure; ++using ImageFail = Software::Image::ImageFailure; ++using BusyFail = Software::Image::BusyFailure; + + static constexpr const uint32_t pfmPos = 2054; + static constexpr const uint32_t block0Magic = 0xB6EAFD19; +@@ -74,6 +78,8 @@ int Manager::verifyPFRImage(const std::filesystem::path imgPath, + phosphor::logging::log<phosphor::logging::level::ERR>( + "Image magic number match failed", + phosphor::logging::entry("IMAGEMAGIC=0x%x", imgMagic)); ++ phosphor::logging::report<UnTarFailure>( ++ UnTarFail::PATH(imgPath.c_str())); + return -1; + } + +@@ -108,6 +114,8 @@ int Manager::verifyPFRImage(const std::filesystem::path imgPath, + + phosphor::logging::log<phosphor::logging::level::ERR>( + "Unknown image type"); ++ phosphor::logging::report<ImageFailure>( ++ ImageFail::PATH(imgPath.c_str())); + return -1; + } + +@@ -151,6 +159,8 @@ int Manager::verifyPFRImage(const std::filesystem::path imgPath, + "PRIORITY=%i", LOG_ERR, "REDFISH_MESSAGE_ID=%s", + redfishMsgID.c_str(), "REDFISH_MESSAGE_ARGS=%s", + "Image HASH check fail", NULL); ++ phosphor::logging::report<ImageFailure>( ++ ImageFail::PATH(imgPath.c_str())); + return -1; + } + +@@ -165,6 +175,8 @@ int Manager::verifyPFRImage(const std::filesystem::path imgPath, + catch (std::exception& e) + { + phosphor::logging::log<phosphor::logging::level::ERR>(e.what()); ++ phosphor::logging::report<ImageFailure>( ++ ImageFail::PATH(imgPath.c_str())); + return -1; + } + } +@@ -180,6 +192,12 @@ int Manager::processImage(const std::string& imgFilePath) + if (!std::filesystem::exists(imgPath)) + return -1; + ++ if (isFwupdScriptRunning(bus)) ++ { ++ phosphor::logging::report<BusyFailure>(BusyFail::PATH(imgPath.c_str())); ++ return -1; ++ } ++ + int retry = 3; + std::string ver; + std::string purposeString; +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0011-Fix-for-RedudancyPriority-in-item_updater.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0011-Fix-for-RedudancyPriority-in-item_updater.patch new file mode 100644 index 000000000..4c8f82aa3 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0011-Fix-for-RedudancyPriority-in-item_updater.patch @@ -0,0 +1,38 @@ +From 0babf82f51561ac92a9b0dd56991d8de01930129 Mon Sep 17 00:00:00 2001 +From: Vikram Bodireddy <vikram.bodireddy@intel.com> +Date: Sun, 5 Jul 2020 00:54:57 +0530 +Subject: [PATCH] Fix for RedudancyPriority in item_updater + +This fixes accessing RedudancyPriority property for the +activated image in item_updater. The downloaded image object +is not actually associated with RedudancyPriority before and +after activation. There exists no RedundancyPriority property +for downloaded image, accessing it causing a crash in +item_updater. + +Tested: Tested for coredumps during Seamless firmware update. + +Signed-off-by: Vikram Bodireddy <vikram.bodireddy@intel.com> +--- + item_updater.cpp | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/item_updater.cpp b/item_updater.cpp +index af01e39..8d7bb82 100644 +--- a/item_updater.cpp ++++ b/item_updater.cpp +@@ -655,8 +655,9 @@ void ItemUpdater::freeSpace(Activation& caller) + // Failed activations don't have priority, assign them a large value + // for sorting purposes. + auto priority = 999; +- if (iter.second.get()->activation() == +- server::Activation::Activations::Active) ++ if ((iter.second.get()->activation() == ++ server::Activation::Activations::Active)&& ++ iter.second->redundancyPriority.get()) + { + priority = iter.second->redundancyPriority.get()->priority(); + } +-- +2.17.1 + |