diff mbox series

i40e: Fix error handling code of label err_set_queues

Message ID 20210713122028.463450-1-mudongliangabcd@gmail.com (mailing list archive)
State Awaiting Upstream
Delegated to: Netdev Maintainers
Headers show
Series i40e: Fix error handling code of label err_set_queues | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Guessed tree name to be net-next
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cc_maintainers success CCed 9 of 9 maintainers
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch fail CHECK: Unnecessary parentheses around 'vsi->netdev' CHECK: Unnecessary parentheses around 'vsi->type == I40E_VSI_FDIR' ERROR: Unrecognized email address: 'Dongliang Mu (mudongliangabcd@gmail.com)'
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success Link

Commit Message

Dongliang Mu July 13, 2021, 12:20 p.m. UTC
If i40e_up_complete fails in i40e_vsi_open, it goes to err_up_complete.
The label err_set_queues has an issue: if the else branch is executed,
there is no need to execute i40e_vsi_request_irq.

Fix this by adding a condition of i40e_vsi_free_irq.

Reported-by: Dongliang Mu (mudongliangabcd@gmail.com)
Fixes: 9c04cfcd4aad ("i40e: Fix error handling in i40e_vsi_open")
Fixes: c22e3c6c7912 ("i40e: prep vsi_open logic for non-netdev cases")
Signed-off-by: Dongliang Mu <mudongliangabcd@gmail.com>
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Shannon Nelson July 13, 2021, 3:16 p.m. UTC | #1
On 7/13/21 5:20 AM, Dongliang Mu wrote:
> If i40e_up_complete fails in i40e_vsi_open, it goes to err_up_complete.
> The label err_set_queues has an issue: if the else branch is executed,
> there is no need to execute i40e_vsi_request_irq.

This is unnecessary: if the else branch is executed then control will 
goto err_setup_rx, skipping over i40e_up_complete().

sln

>
> Fix this by adding a condition of i40e_vsi_free_irq.
>
> Reported-by: Dongliang Mu (mudongliangabcd@gmail.com)
> Fixes: 9c04cfcd4aad ("i40e: Fix error handling in i40e_vsi_open")
> Fixes: c22e3c6c7912 ("i40e: prep vsi_open logic for non-netdev cases")
> Signed-off-by: Dongliang Mu <mudongliangabcd@gmail.com>
> ---
>   drivers/net/ethernet/intel/i40e/i40e_main.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
> index 861e59a350bd..ae54468c7001 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_main.c
> +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
> @@ -8720,7 +8720,8 @@ int i40e_vsi_open(struct i40e_vsi *vsi)
>   err_up_complete:
>   	i40e_down(vsi);
>   err_set_queues:
> -	i40e_vsi_free_irq(vsi);
> +	if ((vsi->netdev) || (vsi->type == I40E_VSI_FDIR))
> +		i40e_vsi_free_irq(vsi);
>   err_setup_rx:
>   	i40e_vsi_free_rx_resources(vsi);
>   err_setup_tx:
Dongliang Mu July 14, 2021, 2:24 a.m. UTC | #2
On Tue, Jul 13, 2021 at 11:16 PM Shannon Nelson <snelson@pensando.io> wrote:
>
> On 7/13/21 5:20 AM, Dongliang Mu wrote:
> > If i40e_up_complete fails in i40e_vsi_open, it goes to err_up_complete.
> > The label err_set_queues has an issue: if the else branch is executed,
> > there is no need to execute i40e_vsi_request_irq.
>
> This is unnecessary: if the else branch is executed then control will
> goto err_setup_rx, skipping over i40e_up_complete().

Oh, yes. Thank you. Please ignore this patch.

>
> sln
>
> >
> > Fix this by adding a condition of i40e_vsi_free_irq.
> >
> > Reported-by: Dongliang Mu (mudongliangabcd@gmail.com)
> > Fixes: 9c04cfcd4aad ("i40e: Fix error handling in i40e_vsi_open")
> > Fixes: c22e3c6c7912 ("i40e: prep vsi_open logic for non-netdev cases")
> > Signed-off-by: Dongliang Mu <mudongliangabcd@gmail.com>
> > ---
> >   drivers/net/ethernet/intel/i40e/i40e_main.c | 3 ++-
> >   1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
> > index 861e59a350bd..ae54468c7001 100644
> > --- a/drivers/net/ethernet/intel/i40e/i40e_main.c
> > +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
> > @@ -8720,7 +8720,8 @@ int i40e_vsi_open(struct i40e_vsi *vsi)
> >   err_up_complete:
> >       i40e_down(vsi);
> >   err_set_queues:
> > -     i40e_vsi_free_irq(vsi);
> > +     if ((vsi->netdev) || (vsi->type == I40E_VSI_FDIR))
> > +             i40e_vsi_free_irq(vsi);
> >   err_setup_rx:
> >       i40e_vsi_free_rx_resources(vsi);
> >   err_setup_tx:
>
diff mbox series

Patch

diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 861e59a350bd..ae54468c7001 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -8720,7 +8720,8 @@  int i40e_vsi_open(struct i40e_vsi *vsi)
 err_up_complete:
 	i40e_down(vsi);
 err_set_queues:
-	i40e_vsi_free_irq(vsi);
+	if ((vsi->netdev) || (vsi->type == I40E_VSI_FDIR))
+		i40e_vsi_free_irq(vsi);
 err_setup_rx:
 	i40e_vsi_free_rx_resources(vsi);
 err_setup_tx: