diff options
author | Chuhong Yuan <hslester96@gmail.com> | 2019-08-06 09:59:50 +0800 |
---|---|---|
committer | Saeed Mahameed <saeedm@mellanox.com> | 2019-08-07 11:01:48 -0700 |
commit | 94f3e14e00fd43024b1c4d8e0c1e442db9b4d964 (patch) | |
tree | 5012c07d8fd3dcda85e4ee588d77332e6ab0d854 /include/linux/mlx5 | |
parent | net/mlx5: remove self-assignment on esw->dev (diff) | |
download | linux-dev-94f3e14e00fd43024b1c4d8e0c1e442db9b4d964.tar.xz linux-dev-94f3e14e00fd43024b1c4d8e0c1e442db9b4d964.zip |
mlx5: Use refcount_t for refcount
Reference counters are preferred to use refcount_t instead of
atomic_t.
This is because the implementation of refcount_t can prevent
overflows and detect possible use-after-free.
So convert atomic_t ref counters to refcount_t.
Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
Acked-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Diffstat (limited to 'include/linux/mlx5')
-rw-r--r-- | include/linux/mlx5/driver.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h index 267b2bc0ca4a..0acd28f2e62c 100644 --- a/include/linux/mlx5/driver.h +++ b/include/linux/mlx5/driver.h @@ -47,6 +47,7 @@ #include <linux/interrupt.h> #include <linux/idr.h> #include <linux/notifier.h> +#include <linux/refcount.h> #include <linux/mlx5/device.h> #include <linux/mlx5/doorbell.h> @@ -398,7 +399,7 @@ enum mlx5_res_type { struct mlx5_core_rsc_common { enum mlx5_res_type res; - atomic_t refcount; + refcount_t refcount; struct completion free; }; |