From: Simon Horman <horms@kernel.org>
To: aaron.ma@canonical.com
Cc: Simon Horman <horms@kernel.org>,
anthony.l.nguyen@intel.com, przemyslaw.kitszel@intel.com,
andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, henry.w.tieman@intel.com,
intel-wired-lan@lists.osuosl.org
Subject: Re: [PATCH 1/2] ice: restore DDP state during PFR recovery
Date: Sat, 5 Sep 2026 17:43:50 +0100 [thread overview]
Message-ID: <20260905164350.150004-1-horms@kernel.org> (raw)
In-Reply-To: <20260903074706.602087-1-aaron.ma@canonical.com>
This is an AI-generated review of your patch. The human sending this
email has considered the AI review valid, or at least plausible.
Full review at: https://sashiko.dev/#/patchset/20260903074706.602087-2-aaron.ma@canonical.com?part=1
---
Subject: ice: restore DDP state during PFR recovery
This patch serializes rebuilds across PFs of the same adapter while allowing
each PFR to complete independently. It reloads the DDP package from its
cached copy and restores the default DVM recipes before rebuilding the
remaining PF state.
Fixes: 462acf6aca85 ("ice: Enable DDP package download")
[ ... ]
> diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
> index d88835482d3aa..a97a1941cec6a 100644
> --- a/drivers/net/ethernet/intel/ice/ice_main.c
> +++ b/drivers/net/ethernet/intel/ice/ice_main.c
> @@ -659,7 +659,9 @@ static void ice_do_reset(struct ice_pf *pf, enum ice_reset_req reset_type)
> */
> if (reset_type == ICE_RESET_PFR) {
> pf->pfr_count++;
> + mutex_lock(&pf->adapter->rebuild_lock);
> ice_rebuild(pf, reset_type);
> + mutex_unlock(&pf->adapter->rebuild_lock);
[Severity: High]
Can this cause a use-after-free of pf->adapter during concurrent device
removal?
If a device reset triggered in the service task takes longer than the
timeout, ice_remove() proceeds to teardown and calls ice_adapter_put().
For the last PF on the adapter, this drops the refcount to zero and frees
the adapter structure memory.
However, the service task is only explicitly halted by ice_deinit_dev()
after this point:
ice_remove()
...
ice_adapter_put(pdev);
ice_deinit_hw(&pf->hw);
ice_deinit_dev(pf); /* service task halted here */
If the service task was executing ice_do_reset(), it will eventually
complete the rebuild and call mutex_unlock(&pf->adapter->rebuild_lock),
dereferencing the freed adapter structure.
> clear_bit(ICE_PREPARED_FOR_RESET, pf->state);
> clear_bit(ICE_PFR_REQ, pf->state);
> wake_up(&pf->reset_wait_queue);
> @@ -704,7 +706,9 @@ static void ice_reset_subtask(struct ice_pf *pf)
> } else {
> /* done with reset. start rebuild */
> pf->hw.reset_ongoing = false;
> + mutex_lock(&pf->adapter->rebuild_lock);
> ice_rebuild(pf, reset_type);
> + mutex_unlock(&pf->adapter->rebuild_lock);
[Severity: High]
Similarly, does this reset subtask release the rebuild_lock on a potentially
freed adapter structure if the remove timeout expired while the rebuild was
in progress?
> /* clear bit to resume normal operations, but
> * ICE_NEEDS_RESTART bit is set in case rebuild failed
> */
[ ... ]
prev parent reply other threads:[~2026-09-05 16:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-03 7:47 Aaron Ma
2026-09-03 7:47 ` [PATCH 2/2] ice: clear Flow Director entries before reset cleanup Aaron Ma
2026-09-04 15:08 ` Przemek Kitszel
2026-09-05 16:46 ` Simon Horman
2026-09-04 15:08 ` [PATCH 1/2] ice: restore DDP state during PFR recovery Przemek Kitszel
2026-09-05 16:43 ` Simon Horman [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=20260905164350.150004-1-horms@kernel.org \
--to=horms@kernel.org \
--cc=aaron.ma@canonical.com \
--cc=andrew+netdev@lunn.ch \
--cc=anthony.l.nguyen@intel.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=henry.w.tieman@intel.com \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=przemyslaw.kitszel@intel.com \
/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®