aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/core/uverbs.h
diff options
context:
space:
mode:
authorWeihang Li <liweihang@huawei.com>2021-05-28 17:37:38 +0800
committerJason Gunthorpe <jgg@nvidia.com>2021-06-08 15:04:36 -0300
commitec9bf373f2458f4b5f1ece8b93a07e6204081667 (patch)
tree0deb7c0393d151262cfb2e41bd019889fd3de5a9 /drivers/infiniband/core/uverbs.h
parentRDMA/ipoib: Use refcount_t instead of atomic_t for reference counting (diff)
downloadlinux-dev-ec9bf373f2458f4b5f1ece8b93a07e6204081667.tar.xz
linux-dev-ec9bf373f2458f4b5f1ece8b93a07e6204081667.zip
RDMA/core: Use refcount_t instead of atomic_t on refcount of ib_uverbs_device
The refcount_t API will WARN on underflow and overflow of a reference counter, and avoid use-after-free risks. Link: https://lore.kernel.org/r/1622194663-2383-8-git-send-email-liweihang@huawei.com Signed-off-by: Weihang Li <liweihang@huawei.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Diffstat (limited to 'drivers/infiniband/core/uverbs.h')
-rw-r--r--drivers/infiniband/core/uverbs.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/infiniband/core/uverbs.h b/drivers/infiniband/core/uverbs.h
index 53a10479958b..821d93c8f712 100644
--- a/drivers/infiniband/core/uverbs.h
+++ b/drivers/infiniband/core/uverbs.h
@@ -97,7 +97,7 @@ ib_uverbs_init_udata_buf_or_null(struct ib_udata *udata,
*/
struct ib_uverbs_device {
- atomic_t refcount;
+ refcount_t refcount;
u32 num_comp_vectors;
struct completion comp;
struct device dev;