From: Przemek Kitszel <przemyslaw.kitszel@intel.com>
To: <choiniere.vincent@hydroquebec.com>, <intel-wired-lan@lists.osuosl.org>
Cc: Aleksandr Loktionov <aleksandr.loktionov@intel.com>,
Michal Kubiak <michal.kubiak@intel.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Tony Nguyen <anthony.l.nguyen@intel.com>,
"Eric Dumazet" <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<stable@vger.kernel.org>
Subject: Re: [PATCH net] ice: fix Tx hang dump using stale tx_buf[0].skb
Date: Mon, 19 Oct 2026 13:20:14 +0200 [thread overview]
Message-ID: <2b6b01f4-3796-47d5-9f5f-8c548ced2840@intel.com> (raw)
In-Reply-To: <20261016-ice-tx-hang-dump-v1-1-3df0f5979a51@hydroquebec.com>
On 10/16/26 15:08, Vincent Choiniere via B4 Relay wrote:
> From: Vincent Choiniere <choiniere.vincent@hydroquebec.com>
>
> ice_tx_hang_reporter_dump() always reads tx_ring->tx_buf[0].skb,
> regardless of next_to_clean. The Tx cleanup path frees the skb and
> marks the buffer empty without clearing the skb pointer, so slot 0 can
> hold a stale pointer. A NULL check alone does not cover this, and
> devlink_fmsg_dump_skb() can fault on the freed skb.
>
> Read tx_buf[next_to_clean] instead, use its skb only if the buffer type
> is ICE_TX_BUF_SKB, and skip the skb dump otherwise.
>
> Observed on an E810 PF passed through to a KVM guest (Ubuntu 7.0.0-14,
> PREEMPT_RT, local scheduler patch): a delayed queue IRQ led to a Tx
> timeout and a page fault in devlink_fmsg_dump_skb():
>
> BUG: unable to handle page fault for address: 0000000004cd0c11
> Workqueue: ice ice_service_task [ice]
> RIP: devlink_fmsg_dump_skb+0x2d8/0x5d0
> Call Trace:
> ice_tx_hang_reporter_dump+0x1ce/0x210 [ice]
> devlink_health_do_dump+0xcc/0x190
> devlink_health_report+0x1d7/0x260
> ice_report_tx_hang+0x7d/0xa0 [ice]
>
> With this change and auto_dump enabled, starving a queue IRQ thread
> reproduced the Tx timeout; the dump contained the test packet, no Oops
> occurred and the PF recovered.
>
> Fixes: 2a82874a3b7b ("ice: add Tx hang devlink health reporter")
> Link: https://lore.kernel.org/all/20260327072332.130320-1-aleksandr.loktionov@intel.com/
> Cc: stable@vger.kernel.org
> Signed-off-by: Vincent Choiniere <choiniere.vincent@hydroquebec.com>
> ---
> This complements the NULL check in [1]. With only that check, a non-NULL
> but stale tx_buf[0].skb is still dereferenced by devlink_fmsg_dump_skb().
> I have only reproduced the crash on an Ubuntu 7.0.0-14 kernel with
> PREEMPT_RT and a local scheduler patch, and the skb lifetime against
> concurrent Tx cleanup still needs review. Feedback welcome.
>
> In my case next_to_clean was 0xfc while the reporter read slot 0.
> Upstream v7.0, v7.2 and current net main (191aa4154) all read
> tx_buf[0].skb unconditionally. Before this change, recovery stayed
> stuck until reboot.
>
> [1] https://lore.kernel.org/all/20260327072332.130320-1-aleksandr.loktionov@intel.com/
thank you, looks better than simple null check
please add some more null checks as asked by sashiko, then:
Acked-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
> ---
> drivers/net/ethernet/intel/ice/devlink/health.c | 10 +++++++---
> 1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/ice/devlink/health.c b/drivers/net/ethernet/intel/ice/devlink/health.c
> index 8e9a8a817..059859c36 100644
> --- a/drivers/net/ethernet/intel/ice/devlink/health.c
> +++ b/drivers/net/ethernet/intel/ice/devlink/health.c
> @@ -390,12 +390,15 @@ static int ice_tx_hang_reporter_dump(struct devlink_health_reporter *reporter,
> struct netlink_ext_ack *extack)
> {
> struct ice_tx_hang_event *event = priv_ctx;
> - struct sk_buff *skb;
> + struct sk_buff *skb = NULL;
> + struct ice_tx_buf *tx_buf;
>
> if (!event)
> return 0;
>
> - skb = event->tx_ring->tx_buf->skb;
> + tx_buf = &event->tx_ring->tx_buf[event->next_to_clean];
> + if (tx_buf->type == ICE_TX_BUF_SKB)
> + skb = tx_buf->skb;
> devlink_fmsg_obj_nest_start(fmsg);
> ICE_DEVLINK_FMSG_PUT_FIELD(fmsg, event, head);
> ICE_DEVLINK_FMSG_PUT_FIELD(fmsg, event, intr);
> @@ -409,7 +412,8 @@ static int ice_tx_hang_reporter_dump(struct devlink_health_reporter *reporter,
> ice_fmsg_put_ptr(fmsg, "skb-ptr", skb);
> devlink_fmsg_binary_pair_put(fmsg, "desc", event->tx_ring->desc,
> event->tx_ring->count * sizeof(struct ice_tx_desc));
> - devlink_fmsg_dump_skb(fmsg, skb);
> + if (skb)
> + devlink_fmsg_dump_skb(fmsg, skb);
> devlink_fmsg_obj_nest_end(fmsg);
>
> return 0;
>
> ---
> base-commit: 191aa41548b2d2b6af534a6d5cf84a552435c74c
> change-id: 20261016-ice-tx-hang-dump-e46b4ed483d6
>
> Best regards,
> --
> Vincent Choiniere <choiniere.vincent@hydroquebec.com>
>
>
prev parent reply other threads:[~2026-10-19 11:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-16 13:08 Vincent Choiniere via B4 Relay
2026-10-16 16:56 ` Paul Menzel
2026-10-19 11:20 ` Przemek Kitszel [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2b6b01f4-3796-47d5-9f5f-8c548ced2840@intel.com \
--to=przemyslaw.kitszel@intel.com \
--cc=aleksandr.loktionov@intel.com \
--cc=andrew+netdev@lunn.ch \
--cc=anthony.l.nguyen@intel.com \
--cc=choiniere.vincent@hydroquebec.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michal.kubiak@intel.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®