Skip to contentSkip to conversation

xprtrdma: fix pointer derefs in error cases of rpcrdma_ep_create

PATCH In review Larry Bassel 2 participants 2 messages Jun 9, 2025 – Jun 11, 2025 Stable branch

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xprtrdma: fix pointer derefs in error cases of rpcrdma_ep_create

From: Dan Aloni <[email protected]>

[ Upstream commit a9c10b5b3b67b3750a10c8b089b2e05f5e176e33 ]

If there are failures then we must not leave the non-NULL pointers with the error value, otherwise rpcrdma_ep_destroy gets confused and tries free them, resulting in an Oops.

(cherry picked from commit a9c10b5b3b67b3750a10c8b089b2e05f5e176e33)

[Larry: backport to 5.4.y. Minor conflict resolved due to missing commit 93aa8e0a9de80
xprtrdma: Merge struct rpcrdma_ia into struct rpcrdma_ep]

---
 net/sunrpc/xprtrdma/verbs.c | 2 ++
 1 file changed, 2 insertions(+)
net/sunrpc/xprtrdma/verbs.c +2 -0
index cfae1a871578..4fd3f632a2af 100644
@@ -525,6 +525,7 @@ int rpcrdma_ep_create(struct rpcrdma_xprt *r_xprt)
 				 IB_POLL_WORKQUEUE);
 	if (IS_ERR(sendcq)) {
 		rc = PTR_ERR(sendcq);
+		sendcq = NULL;
 		goto out1;
 	}
 
@@ -533,6 +534,7 @@ int rpcrdma_ep_create(struct rpcrdma_xprt *r_xprt)
 				 IB_POLL_WORKQUEUE);
 	if (IS_ERR(recvcq)) {
 		rc = PTR_ERR(recvcq);
+		recvcq = NULL;
 		goto out2;
 	}
 
Signature · 1 line
2.46.0
maintainer
#1 lore raw

[ Sasha's backport helper bot ]

Hi,

✅ All tests passed successfully. No issues detected. No action required from the submitter.

The upstream commit SHA1 provided is correct: a9c10b5b3b67b3750a10c8b089b2e05f5e176e33

WARNING: Author mismatch between patch and upstream commit:
Backport author: Larry Bassel<[email protected]> Commit author: Dan Aloni<[email protected]>

Status in newer kernel trees:

6.15.y | Present (exact SHA1)
6.14.y | Present (exact SHA1)
6.12.y | Present (exact SHA1)

6.6.y | Present (exact SHA1)
6.1.y | Present (exact SHA1)
5.15.y | Present (different SHA1: 9921c866dc36)
5.10.y | Present (different SHA1: 1e7433fb95cc)

Note: The patch differs from the upstream commit:
---

1:  a9c10b5b3b67b < -:  ------------- xprtrdma: fix pointer derefs in error cases of rpcrdma_ep_create
-:  ------------- > 1:  119bab0681b20 xprtrdma: fix pointer derefs in error cases of rpcrdma_ep_create

---

Results of testing on various branches:

| Branch                    | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| stable/linux-5.4.y        |  Success    |  Success   |