linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH wip/jgg-for-next] fixup! RDMA/counter: Combine allocation and bind logic
@ 2020-11-16  6:29 Leon Romanovsky
  2020-11-16 18:37 ` Jason Gunthorpe
  0 siblings, 1 reply; 2+ messages in thread
From: Leon Romanovsky @ 2020-11-16  6:29 UTC (permalink / raw)
  To: Doug Ledford, Jason Gunthorpe; +Cc: Leon Romanovsky, linux-rdma

From: Leon Romanovsky <leonro@nvidia.com>

Jason, please squash this fixup to kbuild report I got tonight, Thanks.

--------
Failure in __rdma_counter_bind_qp() will cause
to mutex_unlock(&port_counter->lock); call again.

Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
---
 drivers/infiniband/core/counters.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/core/counters.c b/drivers/infiniband/core/counters.c
index 4e1ec4479e0b..2c67ba6a2725 100644
--- a/drivers/infiniband/core/counters.c
+++ b/drivers/infiniband/core/counters.c
@@ -124,14 +124,17 @@ static struct rdma_counter *alloc_and_bind(struct ib_device *dev, u8 port,
 	case RDMA_COUNTER_MODE_MANUAL:
 		ret = __counter_set_mode(&port_counter->mode,
 					 RDMA_COUNTER_MODE_MANUAL, 0);
-		if (ret)
+		if (ret) {
+			mutex_unlock(&port_counter->lock);
 			goto err_mode;
+		}
 		break;
 	case RDMA_COUNTER_MODE_AUTO:
 		auto_mode_init_counter(counter, qp, port_counter->mode.mask);
 		break;
 	default:
 		ret = -EOPNOTSUPP;
+		mutex_unlock(&port_counter->lock);
 		goto err_mode;
 	}

@@ -151,7 +154,6 @@ static struct rdma_counter *alloc_and_bind(struct ib_device *dev, u8 port,
 	return counter;

 err_mode:
-	mutex_unlock(&port_counter->lock);
 	kfree(counter->stats);
 err_stats:
 	rdma_restrack_put(&counter->res);
--
2.28.0


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

* Re: [PATCH wip/jgg-for-next] fixup! RDMA/counter: Combine allocation and bind logic
  2020-11-16  6:29 [PATCH wip/jgg-for-next] fixup! RDMA/counter: Combine allocation and bind logic Leon Romanovsky
@ 2020-11-16 18:37 ` Jason Gunthorpe
  0 siblings, 0 replies; 2+ messages in thread
From: Jason Gunthorpe @ 2020-11-16 18:37 UTC (permalink / raw)
  To: Leon Romanovsky; +Cc: Doug Ledford, Leon Romanovsky, linux-rdma

On Mon, Nov 16, 2020 at 08:29:01AM +0200, Leon Romanovsky wrote:
> From: Leon Romanovsky <leonro@nvidia.com>
> 
> Jason, please squash this fixup to kbuild report I got tonight, Thanks.
> 
> --------
> Failure in __rdma_counter_bind_qp() will cause
> to mutex_unlock(&port_counter->lock); call again.
> 
> Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
> ---
>  drivers/infiniband/core/counters.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)

Ok, done

Thanks,
Jason

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

end of thread, other threads:[~2020-11-16 18:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-16  6:29 [PATCH wip/jgg-for-next] fixup! RDMA/counter: Combine allocation and bind logic Leon Romanovsky
2020-11-16 18:37 ` Jason Gunthorpe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).