path: root/drivers
diff options
authorBob Pearson <>2021-03-04 13:20:49 -0600
committerJason Gunthorpe <>2021-03-05 14:11:02 -0400
commit21e27ac82db637d2f48f07b3777aae8e7ca52613 (patch)
tree53d5d0867dd0f9e091f02c978498fea93bae634f /drivers
parentcca7f12b939bd75f3a5e2b0fa20e3de67d1d33b1 (diff)
RDMA/rxe: Fix missed IB reference counting in loopback
When the noted patch below extending the reference taken by rxe_get_dev_from_net() in rxe_udp_encap_recv() until each skb is freed it was not matched by a reference in the loopback path resulting in underflows. Fixes: 899aba891cab ("RDMA/rxe: Fix FIXME in rxe_udp_encap_recv()") Link: Signed-off-by: Bob Pearson <> Signed-off-by: Jason Gunthorpe <>
Diffstat (limited to 'drivers')
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/infiniband/sw/rxe/rxe_net.c b/drivers/infiniband/sw/rxe/rxe_net.c
index 0701bd1ffd1a..01662727dca0 100644
--- a/drivers/infiniband/sw/rxe/rxe_net.c
+++ b/drivers/infiniband/sw/rxe/rxe_net.c
@@ -407,14 +407,22 @@ int rxe_send(struct rxe_pkt_info *pkt, struct sk_buff *skb)
return 0;
+/* fix up a send packet to match the packets
+ * received from UDP before looping them back
+ */
void rxe_loopback(struct sk_buff *skb)
+ struct rxe_pkt_info *pkt = SKB_TO_PKT(skb);
if (skb->protocol == htons(ETH_P_IP))
skb_pull(skb, sizeof(struct iphdr));
skb_pull(skb, sizeof(struct ipv6hdr));
- rxe_rcv(skb);
+ if (WARN_ON(!ib_device_try_get(&pkt->rxe->ib_dev)))
+ kfree_skb(skb);
+ else
+ rxe_rcv(skb);
struct sk_buff *rxe_init_packet(struct rxe_dev *rxe, struct rxe_av *av,