Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Doug Ledford <dledford@redhat.com>, Jason Gunthorpe <jgg@nvidia.com>
Cc: Leon Romanovsky <leonro@nvidia.com>, linux-rdma@vger.kernel.org
Subject: [PATCH wip/jgg-for-next] fixup! RDMA/counter: Combine allocation and bind logic
Date: Mon, 16 Nov 2020 08:29:01 +0200	[thread overview]
Message-ID: <20201116062901.539483-1-leon@kernel.org> (raw)

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


             reply	other threads:[~2020-11-16  6:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-16  6:29 Leon Romanovsky [this message]
2020-11-16 18:37 ` [PATCH wip/jgg-for-next] fixup! RDMA/counter: Combine allocation and bind logic Jason Gunthorpe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201116062901.539483-1-leon@kernel.org \
    --to=leon@kernel.org \
    --cc=dledford@redhat.com \
    --cc=jgg@nvidia.com \
    --cc=leonro@nvidia.com \
    --cc=linux-rdma@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox