gve: fix frag_list chaining
Subsystems (3)
PATCH 1/1 gve: fix frag_list chaining
gve_rx_append_frags() is able to build skbs chained with frag_list, like GRO engine.
Problem is that shinfo->frag_list should only be used for the head of the chain.
All other links should use skb->next pointer.
Otherwise, built skbs are not valid and can cause crashes.
Equivalent code in GRO (skb_gro_receive()) is:
if (NAPI_GRO_CB(p)->last == p)
skb_shinfo(p)->frag_list = skb;
else
NAPI_GRO_CB(p)->last->next = skb;
NAPI_GRO_CB(p)->last = skb;--- drivers/net/ethernet/google/gve/gve_rx_dqo.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/google/gve/gve_rx_dqo.c +4 -1
@@ -570,7 +570,10 @@ static int gve_rx_append_frags(struct napi_struct *napi,if (!skb)return -1 ; -skb_shinfo (rx->ctx.skb_tail)->frag_list = skb; +if (rx->ctx.skb_tail == rx->ctx.skb_head) +skb_shinfo (rx->ctx.skb_head)->frag_list = skb; +else + rx->ctx.skb_tail->next = skb; rx->ctx.skb_tail = skb; num_frags =0 ; }
Signature · 1 line
2.42.0.283.g2d96d420d3-goog
Quoted 18 lines · Eric Dumazet
gve_rx_append_frags()is able to build skbs chained withfrag_list, like GRO engine.Problem is that
shinfo->frag_listshould only be used for the head of the chain.All other links should use
skb->nextpointer.Otherwise, built skbs are not valid and can cause crashes.
Equivalent code in GRO (
skb_gro_receive()) is:if (NAPI_GRO_CB(p)->last == p) skb_shinfo(p)->frag_list = skb; else NAPI_GRO_CB(p)->last->next = skb; NAPI_GRO_CB(p)->last = skb;
Quoted 9 lines
Fixes 9b8dd5e5ea48 ("gve: DQO: Add RX path")Signed-off-by Eric Dumazet <[email protected]>Cc Bailey Forrest <[email protected]>Cc Willem de Bruijn <[email protected]>Cc Catherine Sullivan <[email protected]>--- drivers/net/ethernet/google/gve/gve_rx_dqo.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
This patch was applied to netdev/net.git (main) by David S. Miller <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by David S. Miller <[email protected]>:
Quoted 9 lines · On Thu, 31 Aug 2023 21:38:12 +0000 you wrote:
gve_rx_append_frags()is able to build skbs chained withfrag_list, like GRO engine.Problem is that
shinfo->frag_listshould only be used for the head of the chain.All other links should use
skb->nextpointer.[...]
Here is the summary with links:
- [net] gve: fix frag_list chaining
https://git.kernel.org/netdev/net/c/817c7cd2043a
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html