All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH rdma-next 0/2] RDMA/counter: Two bug fixes in counter error paths
@ 2026-05-20 10:45 Tao Cui
  2026-05-20 10:45 ` [PATCH rdma-next 1/2] RDMA/counter: Fix num_counters leak on bind_qp failure in alloc_and_bind() Tao Cui
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Tao Cui @ 2026-05-20 10:45 UTC (permalink / raw)
  To: leon, jgg, linux-rdma; +Cc: linux-kernel, Tao Cui

This small series fixes two bugs in the RDMA counter subsystem,
both related to error cleanup paths in drivers/infiniband/core/counters.c.

Patch 1 fixes a variable mismatch in rdma_counter_init()'s cleanup loop:
the loop iterates with 'i' but indexes into port_data[] with 'port',
causing double-frees on the failed port and leaking hstats of
previously initialized ports.

Patch 2 fixes a num_counters leak in alloc_and_bind(): when
__rdma_counter_bind_qp() fails, the counter is freed without
decrementing port_counter->num_counters.  This leak accumulates
across repeated failures, permanently preventing the port from
switching back to AUTO mode (-EBUSY) and leaving the mode stuck
in MANUAL when it was originally NONE.

Tao Cui (2):
  RDMA/counter: Fix num_counters leak on bind_qp failure in
    alloc_and_bind()
  RDMA/counter: Fix incorrect port index in rdma_counter_init() error
    cleanup

 drivers/infiniband/core/counters.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-05-25 15:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-20 10:45 [PATCH rdma-next 0/2] RDMA/counter: Two bug fixes in counter error paths Tao Cui
2026-05-20 10:45 ` [PATCH rdma-next 1/2] RDMA/counter: Fix num_counters leak on bind_qp failure in alloc_and_bind() Tao Cui
2026-05-20 10:45 ` [PATCH rdma-next 2/2] RDMA/counter: Fix incorrect port index in rdma_counter_init() error cleanup Tao Cui
2026-05-25 15:42 ` [PATCH rdma-next 0/2] RDMA/counter: Two bug fixes in counter error paths Jason Gunthorpe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.