]> git.baikalelectronics.ru Git - kernel.git/commit
net/mlx5: Fix use after free in mlx5_health_wait_pci_up
authorAmir Tzin <amirtz@nvidia.com>
Wed, 20 Oct 2021 09:45:05 +0000 (12:45 +0300)
committerSaeed Mahameed <saeedm@nvidia.com>
Wed, 1 Dec 2021 06:35:05 +0000 (22:35 -0800)
commit8049cda5e499005da9153bc6e521a8c111db1701
tree9fec1da625d90dc926475ccea703c551ff7f94d1
parent35b28de3e2deff406e79ad3908bfd5a99cc5b7fd
net/mlx5: Fix use after free in mlx5_health_wait_pci_up

The device health recovery flow calls mlx5_health_wait_pci_up() which
queries the device for FW_RESET timeout after freeing the device
timeouts structure on mlx5_function_teardown(). Fix this bug by moving
timeouts structure init/cleanup to the device's init/uninit phases.
Since it is necessary to reset default software timeouts on function
reload, extract setting of defaults values from mlx5_tout_init() and
call mlx5_tout_set_def_val() directly from mlx5_function_setup().

Fixes: ec573aa4e61a ("net/mlx5: Read timeout values from init segment")
Reported by: Niklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: Amir Tzin <amirtz@nvidia.com>
Signed-off-by: Moshe Shemesh <moshe@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
drivers/net/ethernet/mellanox/mlx5/core/lib/tout.c
drivers/net/ethernet/mellanox/mlx5/core/lib/tout.h
drivers/net/ethernet/mellanox/mlx5/core/main.c