linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ixgbe: Fix an error handling path in ixgbe_read_iosf_sb_reg_x550()
@ 2024-01-20 17:25 Christophe JAILLET
  2024-01-22 11:07 ` Simon Horman
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Christophe JAILLET @ 2024-01-20 17:25 UTC (permalink / raw)
  To: Jesse Brandeburg, Tony Nguyen, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Jeff Kirsher, Mark Rustad
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET,
	intel-wired-lan, netdev

All error handling paths, except this one, go to 'out' where
release_swfw_sync() is called.
This call balances the acquire_swfw_sync() call done at the beginning of
the function.

Branch to the error handling path in order to correctly release some
resources in case of error.

Fixes: ae14a1d8e104 ("ixgbe: Fix IOSF SB access issues")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
This patch is speculative, review with care.
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c
index 6208923e29a2..c1adc94a5a65 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c
@@ -716,7 +716,8 @@ static s32 ixgbe_read_iosf_sb_reg_x550(struct ixgbe_hw *hw, u32 reg_addr,
 	if ((command & IXGBE_SB_IOSF_CTRL_RESP_STAT_MASK) != 0) {
 		error = FIELD_GET(IXGBE_SB_IOSF_CTRL_CMPL_ERR_MASK, command);
 		hw_dbg(hw, "Failed to read, error %x\n", error);
-		return -EIO;
+		ret = -EIO;
+		goto out;
 	}
 
 	if (!ret)
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] ixgbe: Fix an error handling path in ixgbe_read_iosf_sb_reg_x550()
  2024-01-20 17:25 [PATCH] ixgbe: Fix an error handling path in ixgbe_read_iosf_sb_reg_x550() Christophe JAILLET
@ 2024-01-22 11:07 ` Simon Horman
       [not found] ` <CYYPR11MB8429776D3D1D830E140F5D64BD7B2@CYYPR11MB8429.namprd11.prod.outlook.com>
  2024-01-29  5:06 ` Pucha, HimasekharX Reddy
  2 siblings, 0 replies; 4+ messages in thread
From: Simon Horman @ 2024-01-22 11:07 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: Jesse Brandeburg, Tony Nguyen, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Jeff Kirsher, Mark Rustad,
	linux-kernel, kernel-janitors, intel-wired-lan, netdev

On Sat, Jan 20, 2024 at 06:25:36PM +0100, Christophe JAILLET wrote:
> All error handling paths, except this one, go to 'out' where
> release_swfw_sync() is called.
> This call balances the acquire_swfw_sync() call done at the beginning of
> the function.
> 
> Branch to the error handling path in order to correctly release some
> resources in case of error.
> 
> Fixes: ae14a1d8e104 ("ixgbe: Fix IOSF SB access issues")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Reviewed-by: Simon Horman <horms@kernel.org>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Intel-wired-lan] [PATCH] ixgbe: Fix an error handling path in ixgbe_read_iosf_sb_reg_x550()
       [not found] ` <CYYPR11MB8429776D3D1D830E140F5D64BD7B2@CYYPR11MB8429.namprd11.prod.outlook.com>
@ 2024-01-24  5:56   ` Christophe JAILLET
  0 siblings, 0 replies; 4+ messages in thread
From: Christophe JAILLET @ 2024-01-24  5:56 UTC (permalink / raw)
  To: Pucha, HimasekharX Reddy
  Cc: Jesse Brandeburg, Tony Nguyen, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Jeff Kirsher, Mark Rustad,
	linux-kernel, kernel-janitors, intel-wired-lan, netdev


Le 24/01/2024 à 05:00, Pucha, HimasekharX Reddy a écrit :
> Hi,
>
> Can you share testing hints for this patch.

Hi,

No I can't.

It was spotted by one of my cocci script that tries to find issues 
related to direct return when a function also has an error handling path 
+ manual review so see if it looks like a real issue.

As said in the patch, "This patch is speculative, review with care.". 
That means that it was not tested from my side.
I don't have the hardware, and don't know how to trigger the issue.

All I know is that the code looks wrong *to me*.

Maybe someone at intel.com could give this hint? :)

CJ


> Regards,
> Himasekhar Reddy.
>
> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of Christophe JAILLET
> Sent: Saturday, January 20, 2024 10:56 PM
> To: Brandeburg, Jesse <jesse.brandeburg@intel.com>; Nguyen, Anthony L <anthony.l.nguyen@intel.com>; David S. Miller <davem@davemloft.net>; Eric Dumazet <edumazet@google.com>; Jakub Kicinski <kuba@kernel.org>; Paolo Abeni <pabeni@redhat.com>; Jeff Kirsher <jeffrey.t.kirsher@intel.com>; Rustad, Mark D <mark.d.rustad@intel.com>
> Cc: Christophe JAILLET <christophe.jaillet@wanadoo.fr>; intel-wired-lan@lists.osuosl.org; kernel-janitors@vger.kernel.org; linux-kernel@vger.kernel.org; netdev@vger.kernel.org
> Subject: [Intel-wired-lan] [PATCH] ixgbe: Fix an error handling path in ixgbe_read_iosf_sb_reg_x550()
>
> All error handling paths, except this one, go to 'out' where
> release_swfw_sync() is called.
> This call balances the acquire_swfw_sync() call done at the beginning of
> the function.
>
> Branch to the error handling path in order to correctly release some
> resources in case of error.
>
> Fixes: ae14a1d8e104 ("ixgbe: Fix IOSF SB access issues")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> This patch is speculative, review with care.
> ---
>   drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c
> index 6208923e29a2..c1adc94a5a65 100644
> --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c
> +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c
> @@ -716,7 +716,8 @@ static s32 ixgbe_read_iosf_sb_reg_x550(struct ixgbe_hw *hw, u32 reg_addr,
>   	if ((command & IXGBE_SB_IOSF_CTRL_RESP_STAT_MASK) != 0) {
>   		error = FIELD_GET(IXGBE_SB_IOSF_CTRL_CMPL_ERR_MASK, command);
>   		hw_dbg(hw, "Failed to read, error %x\n", error);
> -		return -EIO;
> +		ret = -EIO;
> +		goto out;
>   	}
>   
>   	if (!ret)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [Intel-wired-lan] [PATCH] ixgbe: Fix an error handling path in ixgbe_read_iosf_sb_reg_x550()
  2024-01-20 17:25 [PATCH] ixgbe: Fix an error handling path in ixgbe_read_iosf_sb_reg_x550() Christophe JAILLET
  2024-01-22 11:07 ` Simon Horman
       [not found] ` <CYYPR11MB8429776D3D1D830E140F5D64BD7B2@CYYPR11MB8429.namprd11.prod.outlook.com>
@ 2024-01-29  5:06 ` Pucha, HimasekharX Reddy
  2 siblings, 0 replies; 4+ messages in thread
From: Pucha, HimasekharX Reddy @ 2024-01-29  5:06 UTC (permalink / raw)
  To: Christophe JAILLET, Brandeburg, Jesse, Nguyen, Anthony L,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Jeff Kirsher, Rustad, Mark D
  Cc: intel-wired-lan, kernel-janitors, linux-kernel, netdev

> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of Christophe JAILLET
> Sent: Saturday, January 20, 2024 10:56 PM
> To: Brandeburg, Jesse <jesse.brandeburg@intel.com>; Nguyen, Anthony L <anthony.l.nguyen@intel.com>; David S. Miller <davem@davemloft.net>; Eric Dumazet <edumazet@google.com>; Jakub Kicinski <kuba@kernel.org>; Paolo Abeni <pabeni@redhat.com>; Jeff Kirsher <jeffrey.t.kirsher@intel.com>; Rustad, Mark D <mark.d.rustad@intel.com>
> Cc: Christophe JAILLET <christophe.jaillet@wanadoo.fr>; intel-wired-lan@lists.osuosl.org; kernel-janitors@vger.kernel.org; linux-kernel@vger.kernel.org; netdev@vger.kernel.org
> Subject: [Intel-wired-lan] [PATCH] ixgbe: Fix an error handling path in ixgbe_read_iosf_sb_reg_x550()
>
> All error handling paths, except this one, go to 'out' where
> release_swfw_sync() is called.
> This call balances the acquire_swfw_sync() call done at the beginning of
> the function.
>
> Branch to the error handling path in order to correctly release some
> resources in case of error.
>
> Fixes: ae14a1d8e104 ("ixgbe: Fix IOSF SB access issues")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> This patch is speculative, review with care.
> ---
>  drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>

Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com> (A Contingent worker at Intel)


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-01-29  5:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-20 17:25 [PATCH] ixgbe: Fix an error handling path in ixgbe_read_iosf_sb_reg_x550() Christophe JAILLET
2024-01-22 11:07 ` Simon Horman
     [not found] ` <CYYPR11MB8429776D3D1D830E140F5D64BD7B2@CYYPR11MB8429.namprd11.prod.outlook.com>
2024-01-24  5:56   ` [Intel-wired-lan] " Christophe JAILLET
2024-01-29  5:06 ` Pucha, HimasekharX Reddy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).