mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
ena: Prevent reset after device destruction
Check for ENA_FLAG_TRIGGER_RESET inside a locked context in order to avoid potential race conditions with ena_destroy_device. This aligns the reset task logic with the Linux driver. Obtained from: Semihalf MFC after: 2 weeks Sponsored by: Amazon, Inc.
This commit is contained in:
parent
36130d2979
commit
433ab9b698
1 changed files with 4 additions and 8 deletions
|
|
@ -3539,15 +3539,11 @@ ena_reset_task(void *arg, int pending)
|
|||
{
|
||||
struct ena_adapter *adapter = (struct ena_adapter *)arg;
|
||||
|
||||
if (unlikely(!ENA_FLAG_ISSET(ENA_FLAG_TRIGGER_RESET, adapter))) {
|
||||
ena_log(adapter->pdev, WARN,
|
||||
"device reset scheduled but trigger_reset is off\n");
|
||||
return;
|
||||
}
|
||||
|
||||
ENA_LOCK_LOCK(adapter);
|
||||
ena_destroy_device(adapter, false);
|
||||
ena_restore_device(adapter);
|
||||
if (likely(ENA_FLAG_ISSET(ENA_FLAG_TRIGGER_RESET, adapter))) {
|
||||
ena_destroy_device(adapter, false);
|
||||
ena_restore_device(adapter);
|
||||
}
|
||||
ENA_LOCK_UNLOCK(adapter);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue