[PATCH wip/jgg-for-next] fixup! RDMA/counter: Combine allocation and bind logic

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Leon Romanovsky <leonro@xxxxxxxxxx>

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@xxxxxxxxxx>
---
 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




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux