Netdev List
 help / color / mirror / Atom feed
From: Przemek Kitszel <przemyslaw.kitszel@intel.com>
To: guohongyu <guohongyu@cmss.chinamobile.com>,
	<intel-wired-lan@lists.osuosl.org>, <netdev@vger.kernel.org>
Cc: <anthony.l.nguyen@intel.com>, <andrew+netdev@lunn.ch>,
	<davem@davemloft.net>, <edumazet@kernel.org>, <kuba@kernel.org>,
	<pabeni@redhat.com>, <13057616121@163.com>
Subject: Re: [PATCH] idpf: fix vport_id used as array index in MAC filter async handler
Date: Thu, 26 Nov 2026 06:09:55 +0100	[thread overview]
Message-ID: <6f89986d-f72a-448b-8909-90bbcddd2974@intel.com> (raw)
In-Reply-To: <20261126020854.233971-1-guohongyu@cmss.chinamobile.com>

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


  parent reply	other threads:[~2026-11-26  5:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-26  2:08 [PATCH] idpf: fix vport_id used as array index in MAC filter async handler guohongyu
2026-11-26  2:18 ` netdev-bot+sinfo
2026-11-26  2:35   ` guohongyu
2026-11-26  5:09 ` Przemek Kitszel [this message]
2026-11-26  9:26 ` [PATCH v2] " Hongyu Guo
2026-11-26  9:38   ` netdev-bot+sinfo

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=6f89986d-f72a-448b-8909-90bbcddd2974@intel.com \
    --to=przemyslaw.kitszel@intel.com \
    --cc=13057616121@163.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=anthony.l.nguyen@intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=guohongyu@cmss.chinamobile.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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