]> git.baikalelectronics.ru Git - kernel.git/commit
RDMA/iw_cxgb4: Fix refcount underflow while destroying cqs.
authorDakshaja Uppalapati <dakshaja@chelsio.com>
Thu, 5 Aug 2021 12:43:32 +0000 (18:13 +0530)
committerJason Gunthorpe <jgg@nvidia.com>
Fri, 6 Aug 2021 01:33:00 +0000 (22:33 -0300)
commit93abd87a07a1d6a2edbd63a0d20de1856420a2e6
tree9fb7afbc32e8c6172a2cac36a79c88e51b5aefb1
parentfdf5213e2206bf9f82dfb9c0708d8d38c30d303d
RDMA/iw_cxgb4: Fix refcount underflow while destroying cqs.

Previous atomic increment/decrement logic expects the atomic count to be
'0' after the final decrement.

Replacing atomic count with refcount does not allow that, as
refcount_dec() considers count of 1 as underflow and triggers a kernel
splat.

Fix the current refcount logic by using the usual pattern of decrementing
the refcount and test if it is '0' on the final deref in
c4iw_destroy_cq(). Use wait_for_completion() instead of wait_event().

Fixes: a2a5dd1335ab ("RDMA/cxgb4: Use refcount_t instead of atomic_t for reference counting")
Link: https://lore.kernel.org/r/1628167412-12114-1-git-send-email-dakshaja@chelsio.com
Signed-off-by: Dakshaja Uppalapati <dakshaja@chelsio.com>
Reviewed-by: Potnuri Bharat Teja <bharat@chelsio.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/hw/cxgb4/cq.c
drivers/infiniband/hw/cxgb4/ev.c
drivers/infiniband/hw/cxgb4/iw_cxgb4.h