Commit 156ee62b authored by David S. Miller's avatar David S. Miller

Merge branch 'mlxsw-Various-fixes'

Ido Schimmel says:

====================
mlxsw: Various fixes

Patch #1 from Jiri fixes a use-after-free discovered while fuzzing mlxsw
/ devlink with syzkaller.

Patch #2 from Amit works around a limitation in new versions of arping,
which is used in several selftests.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents a96ac8a0 46ca1117
...@@ -3986,6 +3986,7 @@ static void mlxsw_sp_ports_remove(struct mlxsw_sp *mlxsw_sp) ...@@ -3986,6 +3986,7 @@ static void mlxsw_sp_ports_remove(struct mlxsw_sp *mlxsw_sp)
mlxsw_sp_port_remove(mlxsw_sp, i); mlxsw_sp_port_remove(mlxsw_sp, i);
mlxsw_sp_cpu_port_remove(mlxsw_sp); mlxsw_sp_cpu_port_remove(mlxsw_sp);
kfree(mlxsw_sp->ports); kfree(mlxsw_sp->ports);
mlxsw_sp->ports = NULL;
} }
static int mlxsw_sp_ports_create(struct mlxsw_sp *mlxsw_sp) static int mlxsw_sp_ports_create(struct mlxsw_sp *mlxsw_sp)
...@@ -4022,6 +4023,7 @@ static int mlxsw_sp_ports_create(struct mlxsw_sp *mlxsw_sp) ...@@ -4022,6 +4023,7 @@ static int mlxsw_sp_ports_create(struct mlxsw_sp *mlxsw_sp)
mlxsw_sp_cpu_port_remove(mlxsw_sp); mlxsw_sp_cpu_port_remove(mlxsw_sp);
err_cpu_port_create: err_cpu_port_create:
kfree(mlxsw_sp->ports); kfree(mlxsw_sp->ports);
mlxsw_sp->ports = NULL;
return err; return err;
} }
...@@ -4143,6 +4145,14 @@ static int mlxsw_sp_local_ports_offset(struct mlxsw_core *mlxsw_core, ...@@ -4143,6 +4145,14 @@ static int mlxsw_sp_local_ports_offset(struct mlxsw_core *mlxsw_core,
return mlxsw_core_res_get(mlxsw_core, local_ports_in_x_res_id); return mlxsw_core_res_get(mlxsw_core, local_ports_in_x_res_id);
} }
static struct mlxsw_sp_port *
mlxsw_sp_port_get_by_local_port(struct mlxsw_sp *mlxsw_sp, u8 local_port)
{
if (mlxsw_sp->ports && mlxsw_sp->ports[local_port])
return mlxsw_sp->ports[local_port];
return NULL;
}
static int mlxsw_sp_port_split(struct mlxsw_core *mlxsw_core, u8 local_port, static int mlxsw_sp_port_split(struct mlxsw_core *mlxsw_core, u8 local_port,
unsigned int count, unsigned int count,
struct netlink_ext_ack *extack) struct netlink_ext_ack *extack)
...@@ -4156,7 +4166,7 @@ static int mlxsw_sp_port_split(struct mlxsw_core *mlxsw_core, u8 local_port, ...@@ -4156,7 +4166,7 @@ static int mlxsw_sp_port_split(struct mlxsw_core *mlxsw_core, u8 local_port,
int i; int i;
int err; int err;
mlxsw_sp_port = mlxsw_sp->ports[local_port]; mlxsw_sp_port = mlxsw_sp_port_get_by_local_port(mlxsw_sp, local_port);
if (!mlxsw_sp_port) { if (!mlxsw_sp_port) {
dev_err(mlxsw_sp->bus_info->dev, "Port number \"%d\" does not exist\n", dev_err(mlxsw_sp->bus_info->dev, "Port number \"%d\" does not exist\n",
local_port); local_port);
...@@ -4251,7 +4261,7 @@ static int mlxsw_sp_port_unsplit(struct mlxsw_core *mlxsw_core, u8 local_port, ...@@ -4251,7 +4261,7 @@ static int mlxsw_sp_port_unsplit(struct mlxsw_core *mlxsw_core, u8 local_port,
int offset; int offset;
int i; int i;
mlxsw_sp_port = mlxsw_sp->ports[local_port]; mlxsw_sp_port = mlxsw_sp_port_get_by_local_port(mlxsw_sp, local_port);
if (!mlxsw_sp_port) { if (!mlxsw_sp_port) {
dev_err(mlxsw_sp->bus_info->dev, "Port number \"%d\" does not exist\n", dev_err(mlxsw_sp->bus_info->dev, "Port number \"%d\" does not exist\n",
local_port); local_port);
......
...@@ -1259,6 +1259,7 @@ static void mlxsw_sx_ports_remove(struct mlxsw_sx *mlxsw_sx) ...@@ -1259,6 +1259,7 @@ static void mlxsw_sx_ports_remove(struct mlxsw_sx *mlxsw_sx)
if (mlxsw_sx_port_created(mlxsw_sx, i)) if (mlxsw_sx_port_created(mlxsw_sx, i))
mlxsw_sx_port_remove(mlxsw_sx, i); mlxsw_sx_port_remove(mlxsw_sx, i);
kfree(mlxsw_sx->ports); kfree(mlxsw_sx->ports);
mlxsw_sx->ports = NULL;
} }
static int mlxsw_sx_ports_create(struct mlxsw_sx *mlxsw_sx) static int mlxsw_sx_ports_create(struct mlxsw_sx *mlxsw_sx)
...@@ -1293,6 +1294,7 @@ static int mlxsw_sx_ports_create(struct mlxsw_sx *mlxsw_sx) ...@@ -1293,6 +1294,7 @@ static int mlxsw_sx_ports_create(struct mlxsw_sx *mlxsw_sx)
if (mlxsw_sx_port_created(mlxsw_sx, i)) if (mlxsw_sx_port_created(mlxsw_sx, i))
mlxsw_sx_port_remove(mlxsw_sx, i); mlxsw_sx_port_remove(mlxsw_sx, i);
kfree(mlxsw_sx->ports); kfree(mlxsw_sx->ports);
mlxsw_sx->ports = NULL;
return err; return err;
} }
...@@ -1376,6 +1378,12 @@ static int mlxsw_sx_port_type_set(struct mlxsw_core *mlxsw_core, u8 local_port, ...@@ -1376,6 +1378,12 @@ static int mlxsw_sx_port_type_set(struct mlxsw_core *mlxsw_core, u8 local_port,
u8 module, width; u8 module, width;
int err; int err;
if (!mlxsw_sx->ports || !mlxsw_sx->ports[local_port]) {
dev_err(mlxsw_sx->bus_info->dev, "Port number \"%d\" does not exist\n",
local_port);
return -EINVAL;
}
if (new_type == DEVLINK_PORT_TYPE_AUTO) if (new_type == DEVLINK_PORT_TYPE_AUTO)
return -EOPNOTSUPP; return -EOPNOTSUPP;
......
...@@ -300,7 +300,7 @@ test_uc_aware() ...@@ -300,7 +300,7 @@ test_uc_aware()
local i local i
for ((i = 0; i < attempts; ++i)); do for ((i = 0; i < attempts; ++i)); do
if $ARPING -c 1 -I $h1 -b 192.0.2.66 -q -w 0.1; then if $ARPING -c 1 -I $h1 -b 192.0.2.66 -q -w 1; then
((passes++)) ((passes++))
fi fi
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment