iavf: Fix double free in iavf_reset_task
[ Upstream commit 16b2dd8cdf6f4e0597c34899de74b4d012b78188 ] 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: e85ff9c631e1 ("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> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
b2bc45327e
commit
735f918cc2
@ -2133,6 +2133,13 @@ restart_watchdog:
|
||||
queue_delayed_work(iavf_wq, &adapter->watchdog_task, HZ * 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* iavf_disable_vf - disable VF
|
||||
* @adapter: board private structure
|
||||
*
|
||||
* Set communication failed flag and free all resources.
|
||||
* NOTE: This function is expected to be called with crit_lock being held.
|
||||
**/
|
||||
static void iavf_disable_vf(struct iavf_adapter *adapter)
|
||||
{
|
||||
struct iavf_mac_filter *f, *ftmp;
|
||||
@ -2187,7 +2194,6 @@ static void iavf_disable_vf(struct iavf_adapter *adapter)
|
||||
memset(adapter->vf_res, 0, IAVF_VIRTCHNL_VF_RESOURCE_SIZE);
|
||||
iavf_shutdown_adminq(&adapter->hw);
|
||||
adapter->netdev->flags &= ~IFF_UP;
|
||||
mutex_unlock(&adapter->crit_lock);
|
||||
adapter->flags &= ~IAVF_FLAG_RESET_PENDING;
|
||||
iavf_change_state(adapter, __IAVF_DOWN);
|
||||
wake_up(&adapter->down_waitqueue);
|
||||
|
Loading…
x
Reference in New Issue
Block a user