linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mlxsw: minimal: Fix an error handling path in 'mlxsw_m_port_create()'
@ 2020-01-25 21:18 Christophe JAILLET
  2020-01-26  8:19 ` Ido Schimmel
  2020-01-27 10:14 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Christophe JAILLET @ 2020-01-25 21:18 UTC (permalink / raw)
  To: jiri, idosch, davem, vadimp
  Cc: netdev, linux-kernel, kernel-janitors, Christophe JAILLET

An 'alloc_etherdev()' called is not ballanced by a corresponding
'free_netdev()' call in one error handling path.

Slighly reorder the error handling code to catch the missed case.

Fixes: c100e47caa8e ("mlxsw: minimal: Add ethtool support")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/net/ethernet/mellanox/mlxsw/minimal.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlxsw/minimal.c b/drivers/net/ethernet/mellanox/mlxsw/minimal.c
index 2b543911ae00..c4caeeadcba9 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/minimal.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/minimal.c
@@ -213,8 +213,8 @@ mlxsw_m_port_create(struct mlxsw_m *mlxsw_m, u8 local_port, u8 module)
 
 err_register_netdev:
 	mlxsw_m->ports[local_port] = NULL;
-	free_netdev(dev);
 err_dev_addr_get:
+	free_netdev(dev);
 err_alloc_etherdev:
 	mlxsw_core_port_fini(mlxsw_m->core, local_port);
 	return err;
-- 
2.20.1


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

* Re: [PATCH] mlxsw: minimal: Fix an error handling path in 'mlxsw_m_port_create()'
  2020-01-25 21:18 [PATCH] mlxsw: minimal: Fix an error handling path in 'mlxsw_m_port_create()' Christophe JAILLET
@ 2020-01-26  8:19 ` Ido Schimmel
  2020-01-27 10:14 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Ido Schimmel @ 2020-01-26  8:19 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: jiri, idosch, davem, vadimp, netdev, linux-kernel, kernel-janitors

On Sat, Jan 25, 2020 at 10:18:47PM +0100, Christophe JAILLET wrote:
> An 'alloc_etherdev()' called is not ballanced by a corresponding
> 'free_netdev()' call in one error handling path.
> 
> Slighly reorder the error handling code to catch the missed case.
> 
> Fixes: c100e47caa8e ("mlxsw: minimal: Add ethtool support")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

For net:

Reviewed-by: Ido Schimmel <idosch@mellanox.com>

Thanks!

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

* Re: [PATCH] mlxsw: minimal: Fix an error handling path in 'mlxsw_m_port_create()'
  2020-01-25 21:18 [PATCH] mlxsw: minimal: Fix an error handling path in 'mlxsw_m_port_create()' Christophe JAILLET
  2020-01-26  8:19 ` Ido Schimmel
@ 2020-01-27 10:14 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2020-01-27 10:14 UTC (permalink / raw)
  To: christophe.jaillet
  Cc: jiri, idosch, vadimp, netdev, linux-kernel, kernel-janitors

From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Date: Sat, 25 Jan 2020 22:18:47 +0100

> An 'alloc_etherdev()' called is not ballanced by a corresponding
> 'free_netdev()' call in one error handling path.
> 
> Slighly reorder the error handling code to catch the missed case.
> 
> Fixes: c100e47caa8e ("mlxsw: minimal: Add ethtool support")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Applied and queued up for -stable, thanks.

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

end of thread, other threads:[~2020-01-27 10:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-25 21:18 [PATCH] mlxsw: minimal: Fix an error handling path in 'mlxsw_m_port_create()' Christophe JAILLET
2020-01-26  8:19 ` Ido Schimmel
2020-01-27 10:14 ` David Miller

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).