Date: Wed, 5 Dec 2018 13:31:14 +0000 (UTC) From: Slava Shwartsman <slavash@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341546 - head/sys/dev/mlx4/mlx4_core Message-ID: <201812051331.wB5DVEJa074109@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: slavash Date: Wed Dec 5 13:31:14 2018 New Revision: 341546 URL: https://svnweb.freebsd.org/changeset/base/341546 Log: mlx4en: Add driver version to sysctl desc Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx4/mlx4_core/mlx4_main.c Modified: head/sys/dev/mlx4/mlx4_core/mlx4_main.c ============================================================================== --- head/sys/dev/mlx4/mlx4_core/mlx4_main.c Wed Dec 5 13:30:48 2018 (r341545) +++ head/sys/dev/mlx4/mlx4_core/mlx4_main.c Wed Dec 5 13:31:14 2018 (r341546) @@ -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 s kfree(priv); return ret; } else { + device_set_desc(pdev->dev.bsddev, mlx4_description); pci_save_state(pdev->dev.bsddev); } @@ -3907,6 +3911,13 @@ static void mlx4_remove_one(struct pci_dev *pdev) mutex_lock(&persist->interface_state_mutex); 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) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201812051331.wB5DVEJa074109>