From: Dima Ruinskiy <dima.ruins...@intel.com> When the driver fails to acquire HW semaphore, there is nothing that can be done to address it, so just leave to avoid an infinite loop.
Fixes: 8cb7c57d9b3c ("net/igc: support device initialization") Cc: sta...@dpdk.org Signed-off-by: Dima Ruinskiy <dima.ruins...@intel.com> Signed-off-by: Anatoly Burakov <anatoly.bura...@intel.com> --- drivers/net/intel/igc/base/igc_i225.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/net/intel/igc/base/igc_i225.c b/drivers/net/intel/igc/base/igc_i225.c index 17a1573064..8f01f8d918 100644 --- a/drivers/net/intel/igc/base/igc_i225.c +++ b/drivers/net/intel/igc/base/igc_i225.c @@ -333,8 +333,15 @@ void igc_release_swfw_sync_i225(struct igc_hw *hw, u16 mask) DEBUGFUNC("igc_release_swfw_sync_i225"); - while (igc_get_hw_semaphore_i225(hw) != IGC_SUCCESS) - ; /* Empty */ + /* Releasing the resource requires first getting the HW semaphore. + * If we fail to get the semaphore, there is nothing we can do, + * except log an error and quit. We are not allowed to hang here + * indefinitely, as it may cause denial of service or system crash. + */ + if (igc_get_hw_semaphore_i225(hw) != IGC_SUCCESS) { + DEBUGOUT("Failed to release SW_FW_SYNC.\n"); + return; + } swfw_sync = IGC_READ_REG(hw, IGC_SW_FW_SYNC); swfw_sync &= ~mask; -- 2.43.5