net/mlx5: Fix null-ptr-deref in mlx5_create_inner_ttc_table()
Subsystems (4)
PATCH v2 1/2 net/mlx5: Fix null-ptr-deref in mlx5_create_inner_ttc_table()
Add NULL check for mlx5_get_flow_namespace() returns in mlx5_create_inner_ttc_table() to prevent NULL pointer dereference.
---
V1 -> V2: Add a empty line after the return statement.
drivers/net/ethernet/mellanox/mlx5/core/lib/fs_ttc.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/lib/fs_ttc.c +3 -0
@@ -655,6 +655,9 @@ struct mlx5_ttc_table *mlx5_create_inner_ttc_table(struct mlx5_core_dev *dev, } ns =mlx5_get_flow_namespace (dev, params->ns_type); +if (!ns) +return ERR_PTR (-EOPNOTSUPP ); + groups = use_l4_type ? &inner_ttc_groups[TTC_GROUPS_USE_L4_TYPE ] : &inner_ttc_groups[TTC_GROUPS_DEFAULT ];
Signature · 1 line
2.34.1
PATCH v2 2/2 net/mlx5: Fix null-ptr-deref in mlx5_create_ttc_table()
Add NULL check for mlx5_get_flow_namespace() returns in mlx5_create_ttc_table() to prevent NULL pointer dereference.
---
V1 -> V2: Add a empty line after the return statement.
drivers/net/ethernet/mellanox/mlx5/core/lib/fs_ttc.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/lib/fs_ttc.c +3 -0
@@ -731,6 +731,9 @@ struct mlx5_ttc_table *mlx5_create_ttc_table(struct mlx5_core_dev *dev, } ns =mlx5_get_flow_namespace (dev, params->ns_type); +if (!ns) +return ERR_PTR (-EOPNOTSUPP ); + groups = use_l4_type ? &ttc_groups[TTC_GROUPS_USE_L4_TYPE ] : &ttc_groups[TTC_GROUPS_DEFAULT ];
Signature · 1 line
2.34.1
Quoted 2 lines
Add NULL check for
mlx5_get_flow_namespace()returns inmlx5_create_inner_ttc_table()to prevent NULL pointer dereference.
* Did you propose to adjust the error handling for three function implementations from a common subdirectory initially?
* Can any other summary phrase variants become more desirable accordingly?
* Would a cover letter usually be helpful for patch series?
Regards,
Markus