diff mbox series

[for-rc] RDMA/core: Fix GID entry ref leak when create_ah fails

Message ID 20230323052140.143843-1-saravanan.vajravel@broadcom.com (mailing list archive)
State Superseded
Delegated to: Jason Gunthorpe
Headers show
Series [for-rc] RDMA/core: Fix GID entry ref leak when create_ah fails | expand

Commit Message

Saravanan Vajravel March 23, 2023, 5:21 a.m. UTC
If AH create request fails, release sgid_attr to avoid
GID entry referrence leak reported while releasing GID
table

Fixes: 1a1f460ff151 ("RDMA: Hold the sgid_attr inside the struct ib_ah/qp")
Reviewed-by: Selvin Xavier <selvin.xavier@broadcom.com>
Signed-off-by: Saravanan Vajravel <saravanan.vajravel@broadcom.com>
---
 drivers/infiniband/core/verbs.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Jason Gunthorpe March 24, 2023, 2:37 p.m. UTC | #1
On Wed, Mar 22, 2023 at 10:21:40PM -0700, Saravanan Vajravel wrote:
> This electronic communication and the information and any files transmitted 
> with it, or attached to it, are confidential and are intended solely for 
> the use of the individual or entity to whom it is addressed and may contain 
> information that is confidential, legally privileged, protected by privacy 
> laws, or otherwise restricted from disclosure to anyone else. If you are 
> not the intended recipient or the person responsible for delivering the 
> e-mail to the intended recipient, you are hereby notified that any use, 
> copying, distributing, dissemination, forwarding, printing, or copying of 
> this e-mail is strictly prohibited. If you received this e-mail in error, 
> please return the e-mail to the sender, delete it from your computer, and 
> destroy any printed copy of it.

I have to throw out patches that have these trailers, please fix your
mailer

Jason
Saravanan Vajravel March 24, 2023, 3:12 p.m. UTC | #2
On Wed, Mar 22, 2023 at 10:21:40PM -0700, Saravanan Vajravel wrote:
> This electronic communication and the information and any files
> transmitted with it, or attached to it, are confidential and are
> intended solely for the use of the individual or entity to whom it is
> addressed and may contain information that is confidential, legally
> privileged, protected by privacy laws, or otherwise restricted from
> disclosure to anyone else. If you are not the intended recipient or
> the person responsible for delivering the e-mail to the intended
> recipient, you are hereby notified that any use, copying,
> distributing, dissemination, forwarding, printing, or copying of this
> e-mail is strictly prohibited. If you received this e-mail in error,
> please return the e-mail to the sender, delete it from your computer,
and destroy any printed copy of it.

> I have to throw out patches that have these trailers, please fix your
mailer
Oops! I will check and fix it.

> Jason
diff mbox series

Patch

diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
index 11b1c1603aeb..b99b3cc283b6 100644
--- a/drivers/infiniband/core/verbs.c
+++ b/drivers/infiniband/core/verbs.c
@@ -532,6 +532,8 @@  static struct ib_ah *_rdma_create_ah(struct ib_pd *pd,
 	else
 		ret = device->ops.create_ah(ah, &init_attr, NULL);
 	if (ret) {
+		if (ah->sgid_attr)
+			rdma_put_gid_attr(ah->sgid_attr);
 		kfree(ah);
 		return ERR_PTR(ret);
 	}