regex/mlx5: fix crash on probe failure
authorMichael Baum <michaelba@nvidia.com>
Wed, 18 Nov 2020 17:00:05 +0000 (17:00 +0000)
committerThomas Monjalon <thomas@monjalon.net>
Sun, 22 Nov 2020 12:17:21 +0000 (13:17 +0100)
commit3423d02b6d3ffcf78803b7c3404cdc6abd072ef6
tree1d808b64fed1c37159099ea0bec56dcb29a62ddf
parentaaa7108d46c92eb7e6e0c27eaf85f7af5da24b24
regex/mlx5: fix crash on probe failure

The mlx5_regex_pci_probe function allocates a mlx5_regex_priv structure
using rte_zmalloc.

If the allocation fails, the function jumps to the dev_error label in
order to release previously allocated resources in the function.
However, in the dev_error label it attempts to refer to the internal
fields of the priv structure and if its allocation fails (as in this
case) it is actually dereferencing to NULL.

Replace the jump with an error label.

Fixes: 1db6ebd4ef58 ("regex/mlx5: fix crash on initialization failure")
Cc: stable@dpdk.org
Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
drivers/regex/mlx5/mlx5_regex.c