[v1,02/24] net/igc/base: fix infinite loop
Checks
Commit Message
From: Dima Ruinskiy <dima.ruinskiy@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: stable@dpdk.org
Signed-off-by: Dima Ruinskiy <dima.ruinskiy@intel.com>
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
drivers/net/intel/igc/base/igc_i225.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
@@ -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;