* Re: [PATCH] idpf: fix vport_id used as array index in MAC filter async handler
[not found] <20261126020854.233971-1-guohongyu@cmss.chinamobile.com>
@ 2026-11-26 2:18 ` netdev-bot+sinfo
2026-11-26 5:04 ` sashiko-bot
` (2 subsequent siblings)
3 siblings, 0 replies; 4+ messages in thread
From: netdev-bot+sinfo @ 2026-11-26 2:18 UTC (permalink / raw)
To: guohongyu
Cc: intel-wired-lan, netdev, anthony.l.nguyen, przemyslaw.kitszel,
andrew+netdev, davem, edumazet, kuba, pabeni, alan.brady, stable,
13057616121
Hi!
This is an automated message. This series looks like a fix, but its
commit messages seem to be missing some information:
- How the issue was discovered, e.g. hit in production, hit during
development, syzbot report, manual code inspection, LLM or static
analysis tool scan.
- Whether the issue was actually triggered, or is only theoretical
(e.g. found by LLM and not proven at runtime). If it was triggered
please include the symptoms, like the stack trace or kernel messages.
- What hardware the change was tested on. For driver fixes please
mention the device (and if relevant firmware version) used for
testing, or say that the change was not tested on real hardware.
Please do not repost the series just to address the above. Instead,
reply to this email with the missing information, so that reviewers
can take it into account.
*IMPORTANT*: If you do repost (for other reasons) - please include
the relevant info in the cover letter or commit messages.
--
The evaluation is done by an LLM so it may be wrong, if you think
that is the case please reply and explain.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] idpf: fix vport_id used as array index in MAC filter async handler
[not found] <20261126020854.233971-1-guohongyu@cmss.chinamobile.com>
2026-11-26 2:18 ` [PATCH] idpf: fix vport_id used as array index in MAC filter async handler netdev-bot+sinfo
@ 2026-11-26 5:04 ` sashiko-bot
2026-11-26 5:09 ` Przemek Kitszel
[not found] ` <20261126092627.255454-1-guohongyu@cmss.chinamobile.com>
3 siblings, 0 replies; 4+ messages in thread
From: sashiko-bot @ 2026-11-26 5:04 UTC (permalink / raw)
To: guohongyu, intel-wired-lan
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] idpf: use-after-free of vport in
idpf_mac_filter_async_handler() on remove
--
commit 6b177b36cf8b8b2ad682680d9ce0837d77dda78f
Author: guohongyu <guohongyu@cmss.chinamobile.com>
idpf: fix vport_id used as array index in MAC filter async handler
This commit indexes adapter->vport_config[] by vport->idx instead of the
raw vport_id from the virtchnl payload in idpf_mac_filter_async_handler().
> diff --git a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
> index dac1d9fc4ab12..7870e8f810fa9 100644
> --- a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
> +++ b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
> @@ -3781,7 +3781,7 @@ static void idpf_mac_filter_async_handler(void *ctx,
> if (!vport)
> goto invalid_payload;
>
> - vport_config = adapter->vport_config[le32_to_cpu(ma_list->vport_id)];
> + vport_config = adapter->vport_config[vport->idx];
[Severity: Medium]
Can dereferencing vport->idx here cause a use-after-free of vport during
driver removal or shutdown?
CPU0 CPU1 (mbx_wq)
idpf_remove()
set_bit(IDPF_REMOVE_IN_PROG, ...)
idpf_vc_core_deinit()
queue_delayed_work(..., &mbx_task)
idpf_deinit_task()
idpf_vport_dealloc()
idpf_mac_filter_async_handler()
vport = idpf_vid_to_vport(...)
idpf_vport_rel()
kfree(vport)
vport->idx <-- use-after-free
adapter->vports[i] = NULL;
During removal, idpf_vc_core_deinit() keeps mbx_task running across
idpf_deinit_task() and relies on async callbacks to bail out when
IDPF_REMOVE_IN_PROG is set, as idpf_ptp_get_tx_tstamp_async_handler()
does. Because idpf_vport_dealloc() frees vport inside idpf_vport_rel()
before clearing adapter->vports[i], and nothing serializes it against
idpf_vid_to_vport(), an arriving MAC filter error reply can obtain a
dangling vport pointer and read vport->idx after vport is freed.
Checking test_bit(IDPF_REMOVE_IN_PROG, adapter->flags) at the start of
idpf_mac_filter_async_handler() would prevent the handler from running
while vports are being torn down.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261126020854.233971-1-guohongyu@cmss.chinamobile.com?part=1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] idpf: fix vport_id used as array index in MAC filter async handler
[not found] <20261126020854.233971-1-guohongyu@cmss.chinamobile.com>
2026-11-26 2:18 ` [PATCH] idpf: fix vport_id used as array index in MAC filter async handler netdev-bot+sinfo
2026-11-26 5:04 ` sashiko-bot
@ 2026-11-26 5:09 ` Przemek Kitszel
[not found] ` <20261126092627.255454-1-guohongyu@cmss.chinamobile.com>
3 siblings, 0 replies; 4+ messages in thread
From: Przemek Kitszel @ 2026-11-26 5:09 UTC (permalink / raw)
To: guohongyu, intel-wired-lan, netdev
Cc: anthony.l.nguyen, andrew+netdev, davem, edumazet, kuba, pabeni,
13057616121
On 11/26/26 3:08 AM, guohongyu wrote:
> idpf_mac_filter_async_handler() resolves the vport for an incoming
> ADD/DEL_MAC_ADDR async response with idpf_vid_to_vport(), but then
> ignores the resolved vport and indexes adapter->vport_config[]
> directly with the raw 32-bit vport_id from the virtchnl message.
> vport_config[] has num_max_vports entries and vport_id is an opaque
> device-side identifier that the protocol does not bound by it, so
> a vport id not smaller than num_max_vports makes the handler read
> past the end of the array and use the garbage result as a
> struct idpf_vport_config (spinlock taken, filter list walked,
> entries list_del()'ed through out-of-bounds pointers).
>
> Fix this by using the software index of the already-resolved vport,
> adapter->vport_config[vport->idx], as every other call site in the
> driver already does. The index comes from the vport allocation
> slot and is always in range.
>
> Fixes: 41252855df77 ("idpf: add async_handler for MAC filter messages")
> Cc: stable@vger.kernel.org
> Signed-off-by: guohongyu <guohongyu@cmss.chinamobile.com>
Thank you for the patch.
For kernel contributions there is expectation to use Firstname Surname
format, could you please update?
Regarding the code, at first glance it's indeed good direction, but
as this is async handler, all kinds of ugly problems could pop up,
as reported by sashiko. Basically, it races with driver removal:
https://sashiko.dev/#/patchset/20261126020854.233971-1-guohongyu%40cmss.chinamobile.com
> ---
> drivers/net/ethernet/intel/idpf/idpf_virtchnl.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
> index 1caf52706973..e72877242612 100644
> --- a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
> +++ b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
> @@ -3794,7 +3794,7 @@ static void idpf_mac_filter_async_handler(void *ctx,
> if (!vport)
> goto invalid_payload;
>
> - vport_config = adapter->vport_config[le32_to_cpu(ma_list->vport_id)];
> + vport_config = adapter->vport_config[vport->idx];
> ma_list_head = &vport_config->user_config.mac_filter_list;
>
> /* We can't do much to reconcile bad filters at this point, however we
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] idpf: fix vport_id used as array index in MAC filter async handler
[not found] ` <20261126092627.255454-1-guohongyu@cmss.chinamobile.com>
@ 2026-11-26 9:38 ` netdev-bot+sinfo
0 siblings, 0 replies; 4+ messages in thread
From: netdev-bot+sinfo @ 2026-11-26 9:38 UTC (permalink / raw)
To: Hongyu Guo
Cc: intel-wired-lan, netdev, anthony.l.nguyen, przemyslaw.kitszel,
andrew+netdev, davem, edumazet, kuba, pabeni, alan.brady, stable,
13057616121
Hi!
This is an automated message. This series looks like a fix, but its
commit messages seem to be missing some information:
- How the issue was discovered, e.g. hit in production, hit during
development, syzbot report, manual code inspection, LLM or static
analysis tool scan.
- Whether the issue was actually triggered, or is only theoretical
(e.g. found by LLM and not proven at runtime). If it was triggered
please include the symptoms, like the stack trace or kernel messages.
- What hardware the change was tested on. For driver fixes please
mention the device (and if relevant firmware version) used for
testing, or say that the change was not tested on real hardware.
Please do not repost the series just to address the above. Instead,
reply to this email with the missing information, so that reviewers
can take it into account.
*IMPORTANT*: If you do repost (for other reasons) - please include
the relevant info in the cover letter or commit messages.
--
The evaluation is done by an LLM so it may be wrong, if you think
that is the case please reply and explain.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-11-26 9:38 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20261126020854.233971-1-guohongyu@cmss.chinamobile.com>
2026-11-26 2:18 ` [PATCH] idpf: fix vport_id used as array index in MAC filter async handler netdev-bot+sinfo
2026-11-26 5:04 ` sashiko-bot
2026-11-26 5:09 ` Przemek Kitszel
[not found] ` <20261126092627.255454-1-guohongyu@cmss.chinamobile.com>
2026-11-26 9:38 ` [PATCH v2] " netdev-bot+sinfo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox