Message ID | 20210311223723.361301-2-saeed@kernel.org |
---|---|
State | New |
Headers | show |
Series | mlx5 updates 2021-03-11 | expand |
Hello: This series was applied to netdev/net-next.git (refs/heads/master): On Thu, 11 Mar 2021 14:37:09 -0800 you wrote: > From: Saeed Mahameed <saeedm@nvidia.com> > > Users of mlx5_eswitch_get_vport() are required to check return value > prior to passing mlx5_vport further. Fix all the places to do not skip > that check. > > Reviewed-by: Eli Cohen <elic@nvidia.com> > Signed-off-by: Leon Romanovsky <leonro@nvidia.com> > Signed-off-by: Saeed Mahameed <saeedm@nvidia.com> > > [...] Here is the summary with links: - [net-next,01/15] net/mlx5: Don't skip vport check https://git.kernel.org/netdev/net-next/c/7bef147a6ab6 - [net-next,02/15] net/mlx5: Remove impossible checks of interface state https://git.kernel.org/netdev/net-next/c/d89edb360705 - [net-next,03/15] net/mlx5: Separate probe vs. reload flows https://git.kernel.org/netdev/net-next/c/6dea2f7eff96 - [net-next,04/15] net/mlx5: Remove second FW tracer check https://git.kernel.org/netdev/net-next/c/7e615b997802 - [net-next,05/15] net/mlx5: Don't rely on interface state bit https://git.kernel.org/netdev/net-next/c/7ad67a20f28f - [net-next,06/15] net/mlx5: Check returned value from health recover sequence https://git.kernel.org/netdev/net-next/c/fe06992b04a9 - [net-next,07/15] net/mlx5e: CT, Avoid false lock dependency warning https://git.kernel.org/netdev/net-next/c/76e68d950a17 - [net-next,08/15] net/mlx5e: fix mlx5e_tc_tun_update_header_ipv6 dummy definition https://git.kernel.org/netdev/net-next/c/87f77a679797 - [net-next,09/15] net/mlx5e: Add missing include https://git.kernel.org/netdev/net-next/c/5632817b144f - [net-next,10/15] net/mlx5: Fix indir stable stubs https://git.kernel.org/netdev/net-next/c/fbeab6be054c - [net-next,11/15] net/mlx5e: mlx5_tc_ct_init does not fail https://git.kernel.org/netdev/net-next/c/51ada5a52379 - [net-next,12/15] net/mlx5: SF, Fix return type https://git.kernel.org/netdev/net-next/c/3094552bcd72 - [net-next,13/15] net/mlx5e: rep: Improve reg_cX conditions https://git.kernel.org/netdev/net-next/c/03e219c4cf84 - [net-next,14/15] net/mlx5: Avoid unnecessary operation https://git.kernel.org/netdev/net-next/c/61e9508f1e5e - [net-next,15/15] net/mlx5e: Alloc flow spec using kvzalloc instead of kzalloc https://git.kernel.org/netdev/net-next/c/9f4d9283388d You are awesome, thank you! -- Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/devlink_port.c b/drivers/net/ethernet/mellanox/mlx5/core/esw/devlink_port.c index cb1e181f4c6a..7bfc84238b3d 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/esw/devlink_port.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/devlink_port.c @@ -120,7 +120,7 @@ struct devlink_port *mlx5_esw_offloads_devlink_port(struct mlx5_eswitch *esw, u1 struct mlx5_vport *vport; vport = mlx5_eswitch_get_vport(esw, vport_num); - return vport->dl_port; + return IS_ERR(vport) ? ERR_CAST(vport) : vport->dl_port; } int mlx5_esw_devlink_sf_port_register(struct mlx5_eswitch *esw, struct devlink_port *dl_port, diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c index aba17835465b..fe1e06d95a12 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c @@ -1141,6 +1141,8 @@ int mlx5_esw_modify_vport_rate(struct mlx5_eswitch *esw, u16 vport_num, struct mlx5_vport *vport; vport = mlx5_eswitch_get_vport(esw, vport_num); + if (IS_ERR(vport)) + return PTR_ERR(vport); if (!vport->qos.enabled) return -EOPNOTSUPP; @@ -1279,6 +1281,8 @@ int mlx5_esw_vport_enable(struct mlx5_eswitch *esw, u16 vport_num, int ret; vport = mlx5_eswitch_get_vport(esw, vport_num); + if (IS_ERR(vport)) + return PTR_ERR(vport); mutex_lock(&esw->state_lock); WARN_ON(vport->enabled); @@ -1326,6 +1330,8 @@ void mlx5_esw_vport_disable(struct mlx5_eswitch *esw, u16 vport_num) struct mlx5_vport *vport; vport = mlx5_eswitch_get_vport(esw, vport_num); + if (IS_ERR(vport)) + return; mutex_lock(&esw->state_lock); if (!vport->enabled) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c index 94cb0217b4f3..703753ac2e02 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c @@ -2554,6 +2554,9 @@ static int esw_create_uplink_offloads_acl_tables(struct mlx5_eswitch *esw) struct mlx5_vport *vport; vport = mlx5_eswitch_get_vport(esw, MLX5_VPORT_UPLINK); + if (IS_ERR(vport)) + return PTR_ERR(vport); + return esw_vport_create_offloads_acl_tables(esw, vport); } @@ -2562,6 +2565,9 @@ static void esw_destroy_uplink_offloads_acl_tables(struct mlx5_eswitch *esw) struct mlx5_vport *vport; vport = mlx5_eswitch_get_vport(esw, MLX5_VPORT_UPLINK); + if (IS_ERR(vport)) + return; + esw_vport_destroy_offloads_acl_tables(esw, vport); }