All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xrpcrdma: add missing error checks in rpcrdma_ep_destroy
@ 2022-01-25 19:17 Dan Aloni
  2022-01-25 19:30 ` Chuck Lever III
  0 siblings, 1 reply; 5+ messages in thread
From: Dan Aloni @ 2022-01-25 19:17 UTC (permalink / raw)
  To: chuck.lever; +Cc: linux-nfs

These pointers can be non-NULL and contain errors if initialization is
aborted early.  This is similar to how `__svc_rdma_free` takes care of
it.

Signed-off-by: Dan Aloni <dan.aloni@vastdata.com>
---
 net/sunrpc/xprtrdma/verbs.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c
index f172d1298013..7f3173073e72 100644
--- a/net/sunrpc/xprtrdma/verbs.c
+++ b/net/sunrpc/xprtrdma/verbs.c
@@ -336,14 +336,14 @@ static void rpcrdma_ep_destroy(struct kref *kref)
 		ep->re_id->qp = NULL;
 	}
 
-	if (ep->re_attr.recv_cq)
+	if (ep->re_attr.recv_cq && !IS_ERR(ep->re_attr.recv_cq))
 		ib_free_cq(ep->re_attr.recv_cq);
 	ep->re_attr.recv_cq = NULL;
-	if (ep->re_attr.send_cq)
+	if (ep->re_attr.send_cq && !IS_ERR(ep->re_attr.send_cq))
 		ib_free_cq(ep->re_attr.send_cq);
 	ep->re_attr.send_cq = NULL;
 
-	if (ep->re_pd)
+	if (ep->re_pd && !IS_ERR(ep->re_pd))
 		ib_dealloc_pd(ep->re_pd);
 	ep->re_pd = NULL;
 
-- 
2.23.0


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

end of thread, other threads:[~2022-01-25 20:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-25 19:17 [PATCH] xrpcrdma: add missing error checks in rpcrdma_ep_destroy Dan Aloni
2022-01-25 19:30 ` Chuck Lever III
2022-01-25 19:46   ` Dan Aloni
2022-01-25 20:06   ` [PATCH] xprtrdma: fix pointer derefs in error cases of rpcrdma_ep_create Dan Aloni
2022-01-25 20:08     ` Chuck Lever III

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.