Skip to content

Commit 16b2dd8

Browse files
Kaaameanguy11
authored andcommitted
iavf: Fix double free in iavf_reset_task
Fix double free possibility in iavf_disable_vf, as crit_lock is freed in caller, iavf_reset_task. Add kernel-doc for iavf_disable_vf. Remove mutex_unlock in iavf_disable_vf. Without this patch there is double free scenario, when calling iavf_reset_task. Fixes: e85ff9c ("iavf: Fix deadlock in iavf_reset_task") Signed-off-by: Przemyslaw Patynowski <przemyslawx.patynowski@intel.com> Suggested-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Mateusz Palczewski <mateusz.palczewski@intel.com> Tested-by: Konrad Jankowski <konrad0.jankowski@intel.com> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
1 parent 1b4ae7d commit 16b2dd8

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

drivers/net/ethernet/intel/iavf/iavf_main.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2541,6 +2541,13 @@ static void iavf_watchdog_task(struct work_struct *work)
25412541
queue_delayed_work(iavf_wq, &adapter->watchdog_task, HZ * 2);
25422542
}
25432543

2544+
/**
2545+
* iavf_disable_vf - disable VF
2546+
* @adapter: board private structure
2547+
*
2548+
* Set communication failed flag and free all resources.
2549+
* NOTE: This function is expected to be called with crit_lock being held.
2550+
**/
25442551
static void iavf_disable_vf(struct iavf_adapter *adapter)
25452552
{
25462553
struct iavf_mac_filter *f, *ftmp;
@@ -2595,7 +2602,6 @@ static void iavf_disable_vf(struct iavf_adapter *adapter)
25952602
memset(adapter->vf_res, 0, IAVF_VIRTCHNL_VF_RESOURCE_SIZE);
25962603
iavf_shutdown_adminq(&adapter->hw);
25972604
adapter->netdev->flags &= ~IFF_UP;
2598-
mutex_unlock(&adapter->crit_lock);
25992605
adapter->flags &= ~IAVF_FLAG_RESET_PENDING;
26002606
iavf_change_state(adapter, __IAVF_DOWN);
26012607
wake_up(&adapter->down_waitqueue);

0 commit comments

Comments
 (0)