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>
This commit is contained in:

committed by
Saeed Mahameed

parent
694a296024
commit
94f3e14e00
@@ -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;
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user