linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 for-rc] RDMA/core: Fix GID entry ref leak when create_ah fails
@ 2023-04-01  6:34 Saravanan Vajravel
  2023-04-12 16:36 ` Jason Gunthorpe
  0 siblings, 1 reply; 2+ messages in thread
From: Saravanan Vajravel @ 2023-04-01  6:34 UTC (permalink / raw)
  To: jgg, leon; +Cc: linux-rdma, Saravanan Vajravel, Selvin Xavier

[-- Attachment #1: Type: text/plain, Size: 891 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>
---
v1->v2:
 - Fix email trailer message

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


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

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

* Re: [PATCH v2 for-rc] RDMA/core: Fix GID entry ref leak when create_ah fails
  2023-04-01  6:34 [PATCH v2 for-rc] RDMA/core: Fix GID entry ref leak when create_ah fails Saravanan Vajravel
@ 2023-04-12 16:36 ` Jason Gunthorpe
  0 siblings, 0 replies; 2+ messages in thread
From: Jason Gunthorpe @ 2023-04-12 16:36 UTC (permalink / raw)
  To: Saravanan Vajravel; +Cc: leon, linux-rdma, Selvin Xavier

On Fri, Mar 31, 2023 at 11:34:24PM -0700, Saravanan Vajravel wrote:
> 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>

Applied to for-next, thanks

Jason

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

end of thread, other threads:[~2023-04-12 16:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-01  6:34 [PATCH v2 for-rc] RDMA/core: Fix GID entry ref leak when create_ah fails Saravanan Vajravel
2023-04-12 16:36 ` 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).