From: Petr Oros <poros@redhat.com>
To: sashiko-reviews@lists.linux.dev
Cc: bpf@vger.kernel.org, intel-wired-lan@lists.osuosl.org
Subject: Re: [PATCH iwl-net 09/10] ice: program multicast magic wake before tearing down the main VSI
Date: Tue, 6 Oct 2026 13:38:46 +0200 [thread overview]
Message-ID: <21e0965d-d247-49b2-86fa-041ead3d8558@redhat.com> (raw)
In-Reply-To: <20261002132815.D3A771F000FF@smtp.kernel.org>
On 10/2/26 15:28, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [High] ice: Use-After-Free in ice_setup_mc_magic_wake() during concurrent devlink reload
> --
>
> commit 6cf8b519dd4de7f3996192dbff4ffe7afc4d34f8
> Author: Petr Oros <poros@redhat.com>
>
> ice: program multicast magic wake before tearing down the main VSI
>
> This commit moves the ice_setup_mc_magic_wake() call earlier in ice_remove()
> before device structures are torn down. It fixes an issue where WoL magic
> packet wake was not set up correctly because it was being called after
> ice_deinit().
>
>> diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
>> index b121faa345c1a..857ba7d92b140 100644
>> --- a/drivers/net/ethernet/intel/ice/ice_main.c
>> +++ b/drivers/net/ethernet/intel/ice/ice_main.c
>> @@ -5465,6 +5465,8 @@ static void ice_remove(struct pci_dev *pdev)
>> if (!ice_is_safe_mode(pf))
>> ice_remove_arfs(pf);
>>
>> + ice_setup_mc_magic_wake(pf);
>> +
>> devl_lock(priv_to_devlink(pf));
> [Severity: High]
> By moving ice_setup_mc_magic_wake() outside of devl_lock(), is it exposed to
> concurrent devlink operations like reload?
>
> If a devlink reload operation executes concurrently with the driver's removal
> routine when Wake-on-LAN is enabled, the reload can call ice_unload() and
> ice_decfg_netdev(). This unregisters and frees the netdev.
A devlink reload can not run concurrently with ice_remove(). Since
commit bf6b200bc80d18 ("devlink: Acquire device lock during reload
command") the reload takes the device lock before the devlink instance
lock, and both the PCI unbind path and device_shutdown() hold that same
device lock for the whole of ice_remove().
>
> When ice_setup_mc_magic_wake() runs unprotected by the devlink lock, can it
> experience a use-after-free when attempting to read the freed netdev's MAC
> address?
>
> drivers/net/ethernet/intel/ice/ice_main.c:ice_setup_mc_magic_wake() {
> ...
> if (vsi->netdev)
> ether_addr_copy(mac_addr, vsi->netdev->dev_addr);
> ...
> }
>
> Would it be safer to place the ice_setup_mc_magic_wake() call after acquiring
> the devlink lock?
No, the netdev can not go away underneath ice_setup_mc_magic_wake()
regardless of where the devlink lock is taken in ice_remove().
>
>> ice_dealloc_all_dynamic_ports(pf);
>> ice_deinit_devlink(pf);
>> @@ -5475,7 +5477,6 @@ static void ice_remove(struct pci_dev *pdev)
>> ice_deinit(pf);
>> ice_vsi_release_all(pf);
>>
>> - ice_setup_mc_magic_wake(pf);
>> ice_set_wake(pf);
>>
>> ice_adapter_put(pdev);
next prev parent reply other threads:[~2026-10-06 11:38 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-02 13:07 [PATCH iwl-net 00/10] ice: port missing i40e fixes Petr Oros
2026-10-02 13:07 ` [PATCH iwl-net 01/10] ice: replay UDP tunnel ports after a core or global reset Petr Oros
2026-10-03 9:52 ` Ivan Vecera
2026-10-05 10:24 ` Loktionov, Aleksandr
2026-10-02 13:07 ` [PATCH iwl-net 02/10] ice: fix IRQ freeing in ice_vsi_req_irq_msix() error path Petr Oros
2026-10-03 9:53 ` Ivan Vecera
2026-10-05 10:24 ` Loktionov, Aleksandr
2026-10-02 13:07 ` [PATCH iwl-net 03/10] ice: stop the LAN Tx queues when ice_vsi_open() fails Petr Oros
2026-10-03 9:54 ` Ivan Vecera
2026-10-05 12:03 ` Petr Oros
2026-10-02 13:07 ` [PATCH iwl-net 04/10] ice: restore the default XPS map after a netdev TC change Petr Oros
2026-10-03 9:55 ` Ivan Vecera
2026-10-05 10:25 ` Loktionov, Aleksandr
2026-10-02 13:07 ` [PATCH iwl-net 05/10] ice: report VF tx_dropped with tx_errors instead of tx_discards Petr Oros
2026-10-03 9:55 ` Ivan Vecera
2026-10-05 10:26 ` Loktionov, Aleksandr
2026-10-02 13:07 ` [PATCH iwl-net 06/10] ice: keep adding MAC filters after one that already exists Petr Oros
2026-10-03 9:55 ` Ivan Vecera
2026-10-05 10:26 ` Loktionov, Aleksandr
2026-10-02 13:07 ` [PATCH iwl-net 07/10] ice: take the switch rule AQ error from the response descriptor Petr Oros
2026-10-02 13:27 ` sashiko-bot
2026-10-06 11:30 ` Petr Oros
2026-10-03 9:55 ` Ivan Vecera
2026-10-05 10:27 ` Loktionov, Aleksandr
2026-10-02 13:07 ` [PATCH iwl-net 08/10] ice: detect a PF reset that does not complete Petr Oros
2026-10-03 9:55 ` Ivan Vecera
2026-10-05 10:27 ` Loktionov, Aleksandr
2026-10-02 13:07 ` [PATCH iwl-net 09/10] ice: program multicast magic wake before tearing down the main VSI Petr Oros
2026-10-02 13:28 ` sashiko-bot
2026-10-06 11:38 ` Petr Oros [this message]
2026-10-03 9:56 ` Ivan Vecera
2026-10-05 10:27 ` Loktionov, Aleksandr
2026-10-02 13:07 ` [PATCH iwl-net 10/10] ice: fix unsigned stat widths Petr Oros
2026-10-02 13:12 ` Loktionov, Aleksandr
2026-10-03 9:56 ` Ivan Vecera
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=21e0965d-d247-49b2-86fa-041ead3d8558@redhat.com \
--to=poros@redhat.com \
--cc=bpf@vger.kernel.org \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=sashiko-reviews@lists.linux.dev \
/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