2020-01-25 21:21:42

by Christophe JAILLET

[permalink] [raw]
Subject: [PATCH] mlxsw: minimal: Fix an error handling path in 'mlxsw_m_port_create()'

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 <[email protected]>
---
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


2020-01-26 08:21:00

by Ido Schimmel

[permalink] [raw]
Subject: Re: [PATCH] mlxsw: minimal: Fix an error handling path in 'mlxsw_m_port_create()'

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 <[email protected]>

For net:

Reviewed-by: Ido Schimmel <[email protected]>

Thanks!

2020-01-27 10:57:08

by David Miller

[permalink] [raw]
Subject: Re: [PATCH] mlxsw: minimal: Fix an error handling path in 'mlxsw_m_port_create()'

From: Christophe JAILLET <[email protected]>
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 <[email protected]>

Applied and queued up for -stable, thanks.