public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH for-next v3 1/2] RDMA/rxe: Remove unnecessary mr testing
@ 2022-10-24  3:31 Li Zhijian
  2022-10-24  5:20 ` [PATCH for-next v3 2/2] RDMA/rxe: Fix mr leak in RESPST_ERR_RNR Li Zhijian
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Li Zhijian @ 2022-10-24  3:31 UTC (permalink / raw)
  To: zyjzyj2000, jgg, leon, linux-rdma; +Cc: linux-kernel, Li Zhijian, Bob Pearson

Before the testing, we already passed it to rxe_mr_copy() where mr could
be dereferenced. so this checking is not needed.

The only way that mr is NULL is when it reaches below line 780 with
 'qp->resp.mr = NULL', which is not possible in Bob's explanation[1].

 778         if (res->state == rdatm_res_state_new) {
 779                 if (!res->replay) {
 780                         mr = qp->resp.mr;
 781                         qp->resp.mr = NULL;
 782                 } else {

[1] https://lore.kernel.org/lkml/30ff25c4-ce66-eac4-eaa2-64c0db203a19@gmail.com/

CC: Bob Pearson <rpearsonhpe@gmail.com>
Signed-off-by: Li Zhijian <lizhijian@fujitsu.com>
---
V3: remove WARN_ON # Yanjun and Bob
---
 drivers/infiniband/sw/rxe/rxe_resp.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/infiniband/sw/rxe/rxe_resp.c b/drivers/infiniband/sw/rxe/rxe_resp.c
index ed5a09e86417..b02639cf8cba 100644
--- a/drivers/infiniband/sw/rxe/rxe_resp.c
+++ b/drivers/infiniband/sw/rxe/rxe_resp.c
@@ -811,8 +811,7 @@ static enum resp_states read_reply(struct rxe_qp *qp,
 
 	rxe_mr_copy(mr, res->read.va, payload_addr(&ack_pkt),
 		    payload, RXE_FROM_MR_OBJ);
-	if (mr)
-		rxe_put(mr);
+	rxe_put(mr);
 
 	if (bth_pad(&ack_pkt)) {
 		u8 *pad = payload_addr(&ack_pkt) + payload;
-- 
1.8.3.1


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

end of thread, other threads:[~2022-10-25  1:29 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-24  3:31 [PATCH for-next v3 1/2] RDMA/rxe: Remove unnecessary mr testing Li Zhijian
2022-10-24  5:20 ` [PATCH for-next v3 2/2] RDMA/rxe: Fix mr leak in RESPST_ERR_RNR Li Zhijian
2022-10-24 11:59   ` Leon Romanovsky
2022-10-24 14:15   ` Bob Pearson
2022-10-24 17:13   ` Jason Gunthorpe
2022-10-25  1:05     ` Li Zhijian
2022-10-24 14:10 ` [PATCH for-next v3 1/2] RDMA/rxe: Remove unnecessary mr testing Bob Pearson
2022-10-24 17:16 ` Jason Gunthorpe

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