diff mbox series

[iwl-next,v1] idpf: cancel mailbox work in error path

Message ID 20231004220610.41979-1-pavan.kumar.linga@intel.com
State Superseded
Headers show
Series [iwl-next,v1] idpf: cancel mailbox work in error path | expand

Commit Message

Pavan Kumar Linga Oct. 4, 2023, 10:06 p.m. UTC
In idpf_vc_core_init, the mailbox work is queued
on a mailbox workqueue but it is not cancelled on error.
This results in a call trace when idpf_mbx_task tries
to access the freed mailbox queue pointer. Fix it by
cancelling the mailbox work in the error path.

Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com>
Signed-off-by: Pavan Kumar Linga <pavan.kumar.linga@intel.com>
---
 drivers/net/ethernet/intel/idpf/idpf_virtchnl.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Tony Nguyen Oct. 5, 2023, 5:25 p.m. UTC | #1
On 10/4/2023 3:06 PM, Pavan Kumar Linga wrote:
> In idpf_vc_core_init, the mailbox work is queued
> on a mailbox workqueue but it is not cancelled on error.
> This results in a call trace when idpf_mbx_task tries
> to access the freed mailbox queue pointer. Fix it by
> cancelling the mailbox work in the error path.

Seems like this is a bug fix; it should still have a Fixes: even if it's 
going to -next.

> Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com>
> Signed-off-by: Pavan Kumar Linga <pavan.kumar.linga@intel.com>
> ---
>   drivers/net/ethernet/intel/idpf/idpf_virtchnl.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
> index 9bc85b2f1709..cbb3f104f899 100644
> --- a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
> +++ b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
> @@ -3140,6 +3140,7 @@ int idpf_vc_core_init(struct idpf_adapter *adapter)
>   
>   err_intr_req:
>   	cancel_delayed_work_sync(&adapter->serv_task);
> +	cancel_delayed_work_sync(&adapter->mbx_task);
>   	idpf_vport_params_buf_rel(adapter);
>   err_netdev_alloc:
>   	kfree(adapter->vports);
Pavan Kumar Linga Oct. 5, 2023, 7:43 p.m. UTC | #2
On 10/5/2023 10:25 AM, Tony Nguyen wrote:
> 
> 
> On 10/4/2023 3:06 PM, Pavan Kumar Linga wrote:
>> In idpf_vc_core_init, the mailbox work is queued
>> on a mailbox workqueue but it is not cancelled on error.
>> This results in a call trace when idpf_mbx_task tries
>> to access the freed mailbox queue pointer. Fix it by
>> cancelling the mailbox work in the error path.
> 
> Seems like this is a bug fix; it should still have a Fixes: even if it's 
> going to -next.
> 

Fixed it in v2.

Thanks,
Pavan

>> Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com>
>> Signed-off-by: Pavan Kumar Linga <pavan.kumar.linga@intel.com>
>> ---
>>   drivers/net/ethernet/intel/idpf/idpf_virtchnl.c | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c 
>> b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
>> index 9bc85b2f1709..cbb3f104f899 100644
>> --- a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
>> +++ b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
>> @@ -3140,6 +3140,7 @@ int idpf_vc_core_init(struct idpf_adapter *adapter)
>>   err_intr_req:
>>       cancel_delayed_work_sync(&adapter->serv_task);
>> +    cancel_delayed_work_sync(&adapter->mbx_task);
>>       idpf_vport_params_buf_rel(adapter);
>>   err_netdev_alloc:
>>       kfree(adapter->vports);
diff mbox series

Patch

diff --git a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
index 9bc85b2f1709..cbb3f104f899 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
+++ b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
@@ -3140,6 +3140,7 @@  int idpf_vc_core_init(struct idpf_adapter *adapter)
 
 err_intr_req:
 	cancel_delayed_work_sync(&adapter->serv_task);
+	cancel_delayed_work_sync(&adapter->mbx_task);
 	idpf_vport_params_buf_rel(adapter);
 err_netdev_alloc:
 	kfree(adapter->vports);