Skip to content

Commit 08acd41

Browse files
rpearsonhpe-designgregkh
authored andcommitted
RDMA/rxe: Fix packet length checks
[ Upstream commit 9a3763e ] In rxe_net.c a received packet, from udp or loopback, is passed to rxe_rcv() in rxe_recv.c as a udp packet. I.e. skb->data is pointing at the udp header. But rxe_rcv() makes length checks to verify the packet is long enough to hold the roce headers as if it were a roce packet. I.e. skb->data pointing at the bth header. A runt packet would appear to have 8 more bytes than it actually does which may lead to incorrect behavior. This patch calls skb_pull() to adjust the skb to point at the bth header before calling rxe_rcv() which fixes this error. Fixes: 8700e3e ("Soft RoCE driver") Link: https://lore.kernel.org/r/20230517172242.1806340-1-rpearsonhpe@gmail.com Signed-off-by: Bob Pearson <rpearsonhpe@gmail.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 01f6f86 commit 08acd41

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

drivers/infiniband/sw/rxe/rxe_net.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,9 @@ static int rxe_udp_encap_recv(struct sock *sk, struct sk_buff *skb)
179179
pkt->mask = RXE_GRH_MASK;
180180
pkt->paylen = be16_to_cpu(udph->len) - sizeof(*udph);
181181

182+
/* remove udp header */
183+
skb_pull(skb, sizeof(struct udphdr));
184+
182185
rxe_rcv(skb);
183186

184187
return 0;
@@ -419,6 +422,9 @@ static int rxe_loopback(struct sk_buff *skb, struct rxe_pkt_info *pkt)
419422
return -EIO;
420423
}
421424

425+
/* remove udp header */
426+
skb_pull(skb, sizeof(struct udphdr));
427+
422428
rxe_rcv(skb);
423429

424430
return 0;

0 commit comments

Comments
 (0)