* [Intel-wired-lan] [PATCH v1 1/1] igc: Fix infinite loop in release_swfw_sync
@ 2022-03-01 13:32 Sasha Neftin
2022-03-15 8:04 ` naamax.meir
0 siblings, 1 reply; 2+ messages in thread
From: Sasha Neftin @ 2022-03-01 13:32 UTC (permalink / raw)
To: intel-wired-lan
An infinite loop may occur if we fail to acquire the HW semaphore,
which is needed for resource release.
This will typically happen if the hardware is surprise-removed.
At this stage there is nothing to do, except log an error and quit.
Suggested-by: Dima Ruinskiy <dima.ruinskiy@intel.com>
Signed-off-by: Sasha Neftin <sasha.neftin@intel.com>
---
drivers/net/ethernet/intel/igc/igc_i225.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/intel/igc/igc_i225.c b/drivers/net/ethernet/intel/igc/igc_i225.c
index 66ea566488d1..59d5c467ea6e 100644
--- a/drivers/net/ethernet/intel/igc/igc_i225.c
+++ b/drivers/net/ethernet/intel/igc/igc_i225.c
@@ -156,8 +156,15 @@ void igc_release_swfw_sync_i225(struct igc_hw *hw, u16 mask)
{
u32 swfw_sync;
- while (igc_get_hw_semaphore_i225(hw))
- ; /* 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)) {
+ hw_dbg("Failed to release SW_FW_SYNC.\n");
+ return;
+ }
swfw_sync = rd32(IGC_SW_FW_SYNC);
swfw_sync &= ~mask;
--
2.30.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [Intel-wired-lan] [PATCH v1 1/1] igc: Fix infinite loop in release_swfw_sync
2022-03-01 13:32 [Intel-wired-lan] [PATCH v1 1/1] igc: Fix infinite loop in release_swfw_sync Sasha Neftin
@ 2022-03-15 8:04 ` naamax.meir
0 siblings, 0 replies; 2+ messages in thread
From: naamax.meir @ 2022-03-15 8:04 UTC (permalink / raw)
To: intel-wired-lan
On 3/1/2022 15:32, Sasha Neftin wrote:
> An infinite loop may occur if we fail to acquire the HW semaphore,
> which is needed for resource release.
> This will typically happen if the hardware is surprise-removed.
> At this stage there is nothing to do, except log an error and quit.
>
> Suggested-by: Dima Ruinskiy<dima.ruinskiy@intel.com>
> Signed-off-by: Sasha Neftin<sasha.neftin@intel.com>
> ---
> drivers/net/ethernet/intel/igc/igc_i225.c | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
Tested-by: Naama Meir <naamax.meir@linux.intel.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osuosl.org/pipermail/intel-wired-lan/attachments/20220315/e4f90db1/attachment.html>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-03-15 8:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-01 13:32 [Intel-wired-lan] [PATCH v1 1/1] igc: Fix infinite loop in release_swfw_sync Sasha Neftin
2022-03-15 8:04 ` naamax.meir
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox