* [PATCH net 1/3] net/mlx5e: Add null check for flow namespace in mlx5e_tc_nic_create_miss_table
@ 2026-03-26 20:58 Oskar Ray-Frayssinet
2026-03-26 20:58 ` [PATCH net 2/3] net/mlx5: Add null check for flow namespace in esw_set_slave_root_fdb Oskar Ray-Frayssinet
2026-03-26 20:58 ` [PATCH net 3/3] net/mlx5: Add null check for flow namespace in mlx5_cmd_set_slave_root_fdb Oskar Ray-Frayssinet
0 siblings, 2 replies; 3+ messages in thread
From: Oskar Ray-Frayssinet @ 2026-03-26 20:58 UTC (permalink / raw)
To: saeedm
Cc: tariqt, mbloch, leon, andrew+netdev, davem, edumazet, kuba,
pabeni, netdev, linux-rdma, linux-kernel, Oskar Ray-Frayssinet
mlx5_get_flow_namespace() can return NULL if the namespace is not
available. Add a null check to prevent potential null pointer
dereference when accessing ns->node.
Signed-off-by: Oskar Ray-Frayssinet <rayfraytech@gmail.com>
---
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
index 1434b65d4746..503c9cc96a02 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
@@ -5216,6 +5216,10 @@ static int mlx5e_tc_nic_create_miss_table(struct mlx5e_priv *priv)
ft_attr.level = MLX5E_TC_MISS_LEVEL;
ft_attr.prio = 0;
ns = mlx5_get_flow_namespace(priv->mdev, MLX5_FLOW_NAMESPACE_KERNEL);
+ if (!ns) {
+ netdev_err(priv->netdev, "failed to get flow namespace\n");
+ return -EOPNOTSUPP;
+ }
*ft = mlx5_create_auto_grouped_flow_table(ns, &ft_attr);
if (IS_ERR(*ft)) {
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH net 2/3] net/mlx5: Add null check for flow namespace in esw_set_slave_root_fdb
2026-03-26 20:58 [PATCH net 1/3] net/mlx5e: Add null check for flow namespace in mlx5e_tc_nic_create_miss_table Oskar Ray-Frayssinet
@ 2026-03-26 20:58 ` Oskar Ray-Frayssinet
2026-03-26 20:58 ` [PATCH net 3/3] net/mlx5: Add null check for flow namespace in mlx5_cmd_set_slave_root_fdb Oskar Ray-Frayssinet
1 sibling, 0 replies; 3+ messages in thread
From: Oskar Ray-Frayssinet @ 2026-03-26 20:58 UTC (permalink / raw)
To: saeedm
Cc: tariqt, mbloch, leon, andrew+netdev, davem, edumazet, kuba,
pabeni, netdev, linux-rdma, linux-kernel, Oskar Ray-Frayssinet
mlx5_get_flow_namespace() can return NULL if the namespace is not
available. Add null checks to prevent potential null pointer
dereference when accessing ns->node in both master and slave branches.
Signed-off-by: Oskar Ray-Frayssinet <rayfraytech@gmail.com>
---
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
index 7a9ee36b8dca..63aff6255c02 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
@@ -2821,6 +2821,8 @@ static int esw_set_slave_root_fdb(struct mlx5_core_dev *master,
if (master) {
ns = mlx5_get_flow_namespace(master,
MLX5_FLOW_NAMESPACE_FDB);
+ if (!ns)
+ return -EOPNOTSUPP;
root = find_root(&ns->node);
mutex_lock(&root->chain_lock);
MLX5_SET(set_flow_table_root_in, in,
@@ -2833,6 +2835,8 @@ static int esw_set_slave_root_fdb(struct mlx5_core_dev *master,
} else {
ns = mlx5_get_flow_namespace(slave,
MLX5_FLOW_NAMESPACE_FDB);
+ if (!ns)
+ return -EOPNOTSUPP;
root = find_root(&ns->node);
mutex_lock(&root->chain_lock);
MLX5_SET(set_flow_table_root_in, in, table_id,
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH net 3/3] net/mlx5: Add null check for flow namespace in mlx5_cmd_set_slave_root_fdb
2026-03-26 20:58 [PATCH net 1/3] net/mlx5e: Add null check for flow namespace in mlx5e_tc_nic_create_miss_table Oskar Ray-Frayssinet
2026-03-26 20:58 ` [PATCH net 2/3] net/mlx5: Add null check for flow namespace in esw_set_slave_root_fdb Oskar Ray-Frayssinet
@ 2026-03-26 20:58 ` Oskar Ray-Frayssinet
1 sibling, 0 replies; 3+ messages in thread
From: Oskar Ray-Frayssinet @ 2026-03-26 20:58 UTC (permalink / raw)
To: saeedm
Cc: tariqt, mbloch, leon, andrew+netdev, davem, edumazet, kuba,
pabeni, netdev, linux-rdma, linux-kernel, Oskar Ray-Frayssinet
mlx5_get_flow_namespace() can return NULL if the namespace is not
available. Add a null check to prevent potential null pointer
dereference when accessing ns->node.
Signed-off-by: Oskar Ray-Frayssinet <rayfraytech@gmail.com>
---
drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c
index c348ee62cd3a..c52d8ca6aa0b 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c
@@ -186,6 +186,8 @@ static int mlx5_cmd_set_slave_root_fdb(struct mlx5_core_dev *master,
} else {
ns = mlx5_get_flow_namespace(slave,
MLX5_FLOW_NAMESPACE_FDB);
+ if (!ns)
+ return -EOPNOTSUPP;
root = find_root(&ns->node);
MLX5_SET(set_flow_table_root_in, in, table_id,
root->root_ft->id);
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-03-26 20:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-26 20:58 [PATCH net 1/3] net/mlx5e: Add null check for flow namespace in mlx5e_tc_nic_create_miss_table Oskar Ray-Frayssinet
2026-03-26 20:58 ` [PATCH net 2/3] net/mlx5: Add null check for flow namespace in esw_set_slave_root_fdb Oskar Ray-Frayssinet
2026-03-26 20:58 ` [PATCH net 3/3] net/mlx5: Add null check for flow namespace in mlx5_cmd_set_slave_root_fdb Oskar Ray-Frayssinet
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox