FAILED: patch "[PATCH] gve: Clear napi->skb before dev_kfree_skb_any()" failed to apply to 5.15-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 5.15-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.15.y
git checkout FETCH_HEAD
git cherry-pick -x 6f4d93b78ade0a4c2cafd587f7b429ce95abb02e
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2024061759-decoy-condiment-7d57@gregkh' --subject-prefix 'PATCH 5.15.y' HEAD^..
Possible dependencies:
6f4d93b78ade ("gve: Clear napi->skb before dev_kfree_skb_any()") 1344e751e910 ("gve: Add RX context.")
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 6f4d93b78ade0a4c2cafd587f7b429ce95abb02e Mon Sep 17 00:00:00 2001
From: Ziwei Xiao <[email protected]>
Date: Wed, 12 Jun 2024 00:16:54 +0000
Subject: [PATCH] gve: Clear napi->skb before dev_kfree_skb_any()
gve_rx_free_skb incorrectly leaves napi->skb referencing an skb after it is freed with dev_kfree_skb_any(). This can result in a subsequent call to napi_get_frags returning a dangling pointer.
Fix this by clearing napi->skb before the skb is freed.
drivers/net/ethernet/google/gve/gve_rx_dqo.c +5 -3
@@ -647,11 +647,13 @@ static void gve_rx_skb_hash(struct sk_buff *skb,skb_set_hash (skb,le32_to_cpu (compl_desc->hash), hash_type); } -static void gve_rx_free_skb (struct gve_rx_ring *rx) +static void gve_rx_free_skb (struct napi_struct *napi,struct gve_rx_ring *rx) {if (!rx->ctx.skb_head)return ; +if (rx->ctx.skb_head == napi->skb) + napi->skb =NULL ;dev_kfree_skb_any (rx->ctx.skb_head); rx->ctx.skb_head =NULL ; rx->ctx.skb_tail =NULL ;
@@ -950,7 +952,7 @@ int gve_rx_poll_dqo(struct gve_notify_block *block, int budget) err =gve_rx_dqo (napi, rx, compl_desc, complq->head, rx->q_num);if (err <0 ) { -gve_rx_free_skb (rx); +gve_rx_free_skb (napi, rx);u64_stats_update_begin (&rx->statss);if (err == -ENOMEM ) rx->rx_skb_alloc_fail++;
@@ -993,7 +995,7 @@ int gve_rx_poll_dqo(struct gve_notify_block *block, int budget)/* gve_rx_complete_skb() will consume skb if successful */ if (gve_rx_complete_skb (rx, napi, compl_desc, feat) !=0 ) { -gve_rx_free_skb (rx); +gve_rx_free_skb (napi, rx);u64_stats_update_begin (&rx->statss); rx->rx_desc_err_dropped_pkt++;u64_stats_update_end (&rx->statss);