* [PATCH net-next] mlxsw: spectrum_router: Fix a double free on error
@ 2020-11-18 13:00 Dan Carpenter
2020-11-18 13:06 ` Ido Schimmel
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2020-11-18 13:00 UTC (permalink / raw)
To: Jiri Pirko, Ido Schimmel
Cc: David S. Miller, Jakub Kicinski, netdev, kernel-janitors
There is a double free here because mlxsw_sp_nexthop6_group_create() and
mlxsw_sp_nexthop6_group_info_init() free "nh_grp". It should only be
freed in the create function.
Fixes: 7f7a417e6a11 ("mlxsw: spectrum_router: Split nexthop group configuration to a different struct")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
index a2e81ad5790f..fde8667a2f60 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
@@ -5423,7 +5423,6 @@ mlxsw_sp_nexthop6_group_info_init(struct mlxsw_sp *mlxsw_sp,
nh = &nhgi->nexthops[i];
mlxsw_sp_nexthop6_fini(mlxsw_sp, nh);
}
- kfree(nh_grp);
return err;
}
--
2.29.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next] mlxsw: spectrum_router: Fix a double free on error
2020-11-18 13:00 [PATCH net-next] mlxsw: spectrum_router: Fix a double free on error Dan Carpenter
@ 2020-11-18 13:06 ` Ido Schimmel
0 siblings, 0 replies; 2+ messages in thread
From: Ido Schimmel @ 2020-11-18 13:06 UTC (permalink / raw)
To: Dan Carpenter
Cc: Jiri Pirko, Ido Schimmel, David S. Miller, Jakub Kicinski, netdev,
kernel-janitors
On Wed, Nov 18, 2020 at 04:00:48PM +0300, Dan Carpenter wrote:
> There is a double free here because mlxsw_sp_nexthop6_group_create() and
> mlxsw_sp_nexthop6_group_info_init() free "nh_grp". It should only be
> freed in the create function.
>
> Fixes: 7f7a417e6a11 ("mlxsw: spectrum_router: Split nexthop group configuration to a different struct")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
> index a2e81ad5790f..fde8667a2f60 100644
> --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
> +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
> @@ -5423,7 +5423,6 @@ mlxsw_sp_nexthop6_group_info_init(struct mlxsw_sp *mlxsw_sp,
> nh = &nhgi->nexthops[i];
> mlxsw_sp_nexthop6_fini(mlxsw_sp, nh);
> }
> - kfree(nh_grp);
Thanks for the patch, Dan.
I already sent a patch yesterday:
https://patchwork.kernel.org/project/netdevbpf/patch/20201117174704.291990-2-idosch@idosch.org/
Note that it is different than yours. It frees 'nhgi' instead of
'nh_grp'. It was a typo.
> return err;
> }
>
> --
> 2.29.2
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-11-18 13:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-18 13:00 [PATCH net-next] mlxsw: spectrum_router: Fix a double free on error Dan Carpenter
2020-11-18 13:06 ` Ido Schimmel
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).