diff options
| author | Slava Shwartsman <slavash@FreeBSD.org> | 2018-12-05 13:31:14 +0000 |
|---|---|---|
| committer | Slava Shwartsman <slavash@FreeBSD.org> | 2018-12-05 13:31:14 +0000 |
| commit | 5dc2eaac65eede1db2ac05e3ef28d75d7930d121 (patch) | |
| tree | 58f276694944e86d63d20179b1b679a3d06d56cb /sys/dev/mlx4 | |
| parent | c8aa689960648b3795b41502aa3b5b1faae87876 (diff) | |
Notes
Diffstat (limited to 'sys/dev/mlx4')
| -rw-r--r-- | sys/dev/mlx4/mlx4_core/mlx4_main.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/sys/dev/mlx4/mlx4_core/mlx4_main.c b/sys/dev/mlx4/mlx4_core/mlx4_main.c index 0826a3dfdcfd..321c3b1f7555 100644 --- a/sys/dev/mlx4/mlx4_core/mlx4_main.c +++ b/sys/dev/mlx4/mlx4_core/mlx4_main.c @@ -121,6 +121,9 @@ MODULE_PARM_DESC(enable_4k_uar, #define RESET_PERSIST_MASK_FLAGS (MLX4_FLAG_SRIOV) +static char mlx4_description[] = "Mellanox driver" + " (" DRV_VERSION ")"; + static char mlx4_version[] = DRV_NAME ": Mellanox ConnectX core driver v" DRV_VERSION " (" DRV_RELDATE ")\n"; @@ -3780,6 +3783,7 @@ static int mlx4_init_one(struct pci_dev *pdev, const struct pci_device_id *id) kfree(priv); return ret; } else { + device_set_desc(pdev->dev.bsddev, mlx4_description); pci_save_state(pdev->dev.bsddev); } @@ -3908,6 +3912,13 @@ static void mlx4_remove_one(struct pci_dev *pdev) persist->interface_state |= MLX4_INTERFACE_STATE_DELETION; mutex_unlock(&persist->interface_state_mutex); + /* + * Clear the device description to avoid use after free, + * because the bsddev is not destroyed when this module is + * unloaded: + */ + device_set_desc(pdev->dev.bsddev, NULL); + /* Disabling SR-IOV is not allowed while there are active vf's */ if (mlx4_is_master(dev) && dev->flags & MLX4_FLAG_SRIOV) { active_vfs = mlx4_how_many_lives_vf(dev); |
