Patchwork [net] bnx2x: add missing napi deletion in error path

login
register
mail settings
Submitter Michal Schmidt
Date March 15, 2013, 3:27 p.m.
Message ID <1363361274-25754-1-git-send-email-mschmidt@redhat.com>
Download mbox | patch
Permalink /patch/228067/
State Accepted
Delegated to: David Miller
Headers show

Comments

Michal Schmidt - March 15, 2013, 3:27 p.m.
If the hardware initialization fails in bnx2x_nic_load() after adding
napi objects, they would not be deleted. A subsequent attempt to unload
the bnx2x module detects a corruption in the napi list.

Add the missing napi deletion to the error path.

Signed-off-by: Michal Schmidt <mschmidt@redhat.com>
---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 1 +
 1 file changed, 1 insertion(+)
Dmitry Kravkov - March 16, 2013, 8:18 a.m.
> -----Original Message-----
> From: Michal Schmidt [mailto:mschmidt@redhat.com]
> Sent: Friday, March 15, 2013 5:28 PM
> To: netdev@vger.kernel.org
> Cc: Merav Sicron; Eilon Greenstein; Dmitry Kravkov; Yuval Mintz
> Subject: [PATCH net] bnx2x: add missing napi deletion in error path
> 
> If the hardware initialization fails in bnx2x_nic_load() after adding
> napi objects, they would not be deleted. A subsequent attempt to unload
> the bnx2x module detects a corruption in the napi list.
> 
> Add the missing napi deletion to the error path.
> 
> Signed-off-by: Michal Schmidt <mschmidt@redhat.com>
> ---
>  drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
> index a923bc4..4046f97 100644
> --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
> +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
> @@ -2760,6 +2760,7 @@ load_error2:
>  	bp->port.pmf = 0;
>  load_error1:
>  	bnx2x_napi_disable(bp);
> +	bnx2x_del_all_napi(bp);
> 
>  	/* clear pf_load status, as it was already set */
>  	if (IS_PF(bp))
> --
> 1.8.1.4
>
Thanks, Michal!

Acked-by: Dmitry Kravkov <dmitry@broadcom.com>
 


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller - March 17, 2013, 4:27 p.m.
From: Michal Schmidt <mschmidt@redhat.com>
Date: Fri, 15 Mar 2013 16:27:54 +0100

> If the hardware initialization fails in bnx2x_nic_load() after adding
> napi objects, they would not be deleted. A subsequent attempt to unload
> the bnx2x module detects a corruption in the napi list.
> 
> Add the missing napi deletion to the error path.
> 
> Signed-off-by: Michal Schmidt <mschmidt@redhat.com>

Applied, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
index a923bc4..4046f97 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
@@ -2760,6 +2760,7 @@  load_error2:
 	bp->port.pmf = 0;
 load_error1:
 	bnx2x_napi_disable(bp);
+	bnx2x_del_all_napi(bp);
 
 	/* clear pf_load status, as it was already set */
 	if (IS_PF(bp))