public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH for-rc] RDMA/core: Fix GID entry ref leak when create_ah fails
@ 2023-03-23  5:21 Saravanan Vajravel
  2023-03-24 14:37 ` Jason Gunthorpe
  0 siblings, 1 reply; 3+ messages in thread
From: Saravanan Vajravel @ 2023-03-23  5:21 UTC (permalink / raw)
  To: jgg, leon, selvin.xavier; +Cc: linux-rdma, Saravanan Vajravel

[-- Attachment #1: Type: text/plain, Size: 1639 bytes --]

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(+)

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);
 	}
-- 
2.27.0


-- 
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.

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4227 bytes --]

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

end of thread, other threads:[~2023-03-24 15:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-23  5:21 [PATCH for-rc] RDMA/core: Fix GID entry ref leak when create_ah fails Saravanan Vajravel
2023-03-24 14:37 ` Jason Gunthorpe
2023-03-24 15:12   ` Saravanan Vajravel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox