* [PATCH] RDMA/rxe: Fix packet length checks
@ 2023-05-17 17:20 Bob Pearson
2023-05-17 17:23 ` Bob Pearson
0 siblings, 1 reply; 2+ messages in thread
From: Bob Pearson @ 2023-05-17 17:20 UTC (permalink / raw)
To: jgg, zyjzyj2000, linux-rdma, jhack; +Cc: Bob Pearson
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: 8700e3e7c485 ("Soft RoCE driver")
Signed-off-by: Bob Pearson <rpearsonhpe@gmail.com>
---
drivers/infiniband/sw/rxe/rxe_net.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/infiniband/sw/rxe/rxe_net.c b/drivers/infiniband/sw/rxe/rxe_net.c
index 2bc7361152ea..26b90b8607ef 100644
--- a/drivers/infiniband/sw/rxe/rxe_net.c
+++ b/drivers/infiniband/sw/rxe/rxe_net.c
@@ -159,6 +159,9 @@ static int rxe_udp_encap_recv(struct sock *sk, struct sk_buff *skb)
pkt->mask = RXE_GRH_MASK;
pkt->paylen = be16_to_cpu(udph->len) - sizeof(*udph);
+ /* remove udp header */
+ skb_pull(skb, sizeof(struct udphdr));
+
rxe_rcv(skb);
return 0;
@@ -401,6 +404,9 @@ static int rxe_loopback(struct sk_buff *skb, struct rxe_pkt_info *pkt)
return -EIO;
}
+ /* remove udp header */
+ skb_pull(skb, sizeof(struct udphdr));
+
rxe_rcv(skb);
return 0;
--
2.37.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] RDMA/rxe: Fix packet length checks
2023-05-17 17:20 [PATCH] RDMA/rxe: Fix packet length checks Bob Pearson
@ 2023-05-17 17:23 ` Bob Pearson
0 siblings, 0 replies; 2+ messages in thread
From: Bob Pearson @ 2023-05-17 17:23 UTC (permalink / raw)
To: jgg, zyjzyj2000, linux-rdma, jhack
On 5/17/23 12:20, Bob Pearson wrote:
> 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: 8700e3e7c485 ("Soft RoCE driver")
> Signed-off-by: Bob Pearson <rpearsonhpe@gmail.com>
> ---
> drivers/infiniband/sw/rxe/rxe_net.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/infiniband/sw/rxe/rxe_net.c b/drivers/infiniband/sw/rxe/rxe_net.c
> index 2bc7361152ea..26b90b8607ef 100644
> --- a/drivers/infiniband/sw/rxe/rxe_net.c
> +++ b/drivers/infiniband/sw/rxe/rxe_net.c
> @@ -159,6 +159,9 @@ static int rxe_udp_encap_recv(struct sock *sk, struct sk_buff *skb)
> pkt->mask = RXE_GRH_MASK;
> pkt->paylen = be16_to_cpu(udph->len) - sizeof(*udph);
>
> + /* remove udp header */
> + skb_pull(skb, sizeof(struct udphdr));
> +
> rxe_rcv(skb);
>
> return 0;
> @@ -401,6 +404,9 @@ static int rxe_loopback(struct sk_buff *skb, struct rxe_pkt_info *pkt)
> return -EIO;
> }
>
> + /* remove udp header */
> + skb_pull(skb, sizeof(struct udphdr));
> +
> rxe_rcv(skb);
>
> return 0;
Ignore this. Should have been for-next.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-05-17 17:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-17 17:20 [PATCH] RDMA/rxe: Fix packet length checks Bob Pearson
2023-05-17 17:23 ` Bob Pearson
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.