Skip to content

Commit 9fd4350

Browse files
Zhu Yanjundledford
authored andcommitted
IB/rxe: avoid double kfree_skb
When skb is sent, it will pass the following functions in soft roce. rxe_send [rdma_rxe] ip_local_out __ip_local_out ip_output ip_finish_output ip_finish_output2 dev_queue_xmit __dev_queue_xmit dev_hard_start_xmit In the above functions, if error occurs in the above functions or iptables rules drop skb after ip_local_out, kfree_skb will be called. So it is not necessary to call kfree_skb in soft roce module again. Or else crash will occur. The steps to reproduce: server client --------- --------- |1.1.1.1|<----rxe-channel--->|1.1.1.2| --------- --------- On server: rping -s -a 1.1.1.1 -v -C 10000 -S 512 On client: rping -c -a 1.1.1.1 -v -C 10000 -S 512 The kernel configs CONFIG_DEBUG_KMEMLEAK and CONFIG_DEBUG_OBJECTS are enabled on both server and client. When rping runs, run the following command in server: iptables -I OUTPUT -p udp --dport 4791 -j DROP Without this patch, crash will occur. CC: Srinivas Eeda <[email protected]> CC: Junxiao Bi <[email protected]> Signed-off-by: Zhu Yanjun <[email protected]> Reviewed-by: Yuval Shaia <[email protected]> Signed-off-by: Doug Ledford <[email protected]>
1 parent 2da36d4 commit 9fd4350

File tree

2 files changed

+1
-6
lines changed

2 files changed

+1
-6
lines changed

drivers/infiniband/sw/rxe/rxe_req.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,6 @@ int rxe_requester(void *arg)
728728
rollback_state(wqe, qp, &rollback_wqe, rollback_psn);
729729

730730
if (ret == -EAGAIN) {
731-
kfree_skb(skb);
732731
rxe_run_task(&qp->req.task, 1);
733732
goto exit;
734733
}

drivers/infiniband/sw/rxe/rxe_resp.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -742,7 +742,6 @@ static enum resp_states read_reply(struct rxe_qp *qp,
742742
err = rxe_xmit_packet(rxe, qp, &ack_pkt, skb);
743743
if (err) {
744744
pr_err("Failed sending RDMA reply.\n");
745-
kfree_skb(skb);
746745
return RESPST_ERR_RNR;
747746
}
748747

@@ -954,10 +953,8 @@ static int send_ack(struct rxe_qp *qp, struct rxe_pkt_info *pkt,
954953
}
955954

956955
err = rxe_xmit_packet(rxe, qp, &ack_pkt, skb);
957-
if (err) {
956+
if (err)
958957
pr_err_ratelimited("Failed sending ack\n");
959-
kfree_skb(skb);
960-
}
961958

962959
err1:
963960
return err;
@@ -1141,7 +1138,6 @@ static enum resp_states duplicate_request(struct rxe_qp *qp,
11411138
if (rc) {
11421139
pr_err("Failed resending result. This flow is not handled - skb ignored\n");
11431140
rxe_drop_ref(qp);
1144-
kfree_skb(skb_copy);
11451141
rc = RESPST_CLEANUP;
11461142
goto out;
11471143
}

0 commit comments

Comments
 (0)