Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: willemb@google.com
To: willemb@google.com, netdev-bot+sashiko@kernel.org, mdshahid03@gmail.com
Cc: tariqt@nvidia.com, andrew+netdev@lunn.ch, davem@davemloft.net,
	 edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
	matanb@mellanox.com,  ogerlitz@mellanox.com,
	jackm@dev.mellanox.co.il, netdev@vger.kernel.org,
	 linux-rdma@vger.kernel.org
Subject: Re: [PATCH net] net/mlx4: fix missing error code in SR-IOV validation
Date: Sat, 05 Dec 2026 22:09:59 -0500	[thread overview]
Message-ID: <willemb.11a26608d0051@google.com> (raw)
In-Reply-To: <willemb.2289dc378a528@google.com>

willemb@ wrote:
> netdev-bot+sashiko@ wrote:
> > Thank you for your contribution! Sashiko AI review found 2 potential
> > issue(s) to consider.

> > Critical: 0 · High: 1 · Medium: 0 · Low: 1

> > If you believe none of the issues are legitimate, please reply to each
> > issue of Medium severity or higher and explain why the AI is wrong.
> > If any of them are legitimate and you plan to respin, please let  
> patchwork
> > know by including "pw-bot: cr" as a separate line at the end of your  
> reply
> > (one such reply per series is enough).

> > - [High] The fix is incomplete.
> > - [Low] The commit message understates the impact and leaves out when  
> the
> >    bug triggers.

> > --

> > net/mlx4: fix missing error code in SR-IOV validation

> > The patch sets err to -EINVAL when SRIOV_VALID_STATE() fails in the
> > non-SYS_EQS branch of mlx4_load_one(). Before this, the function jumped
> > to err_sriov with err still 0 and reported success.

> > > Otherwise, mlx4_load_one() may return success even though
> > > SR-IOV initialization failed.

> > [Severity: Low]
> > This isn't a bug, but could the commit message describe the impact more
> > precisely?

> > When mlx4_load_one() returns 0 here, the err_sriov->err_adev unwind has
> > already done all of this:

> >    - disabled SR-IOV
> >    - decremented pf_loading
> >    - freed dev_vfs
> >    - released HCA ownership
> >    - freed dev_cap
> >    - cleaned up the adev state

> > Probe or a reload then reports success for a device that has already
> > been torn down.

> > It could also say when SRIOV_VALID_STATE() can fail. As far as I can
> > tell, the only way is through the failure exits of mlx4_enable_sriov(),
> > when dev->flags already has MLX4_FLAG_SRIOV set (existing_vfs != 0):

> > drivers/net/ethernet/mellanox/mlx4/main.c:mlx4_enable_sriov() {
> >      ...
> > disable_sriov:
> > 	atomic_dec(&pf_loading);
> > free_mem:
> > 	dev->persist->num_vfs = 0;
> > 	kfree(dev->dev_vfs);
> > 	dev->dev_vfs = NULL;
> > 	return dev_flags & ~MLX4_FLAG_MASTER;
> > }

> > If the dev_vfs allocation fails, for example, this leaves  
> MLX4_FLAG_SRIOV
> > set without MLX4_FLAG_MASTER.

> > The Fixes: target 7ae0e400cd93 goes back to 2014. Should this also carry
> > Cc: stable@vger.kernel.org? Documentation/process/maintainer-netdev.rst
> > now asks netdev patches to follow the standard stable rules.

> > > diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c
> > b/drivers/net/ethernet/mellanox/mlx4/main.c
> > > index 036135df23bf1..c3661a346c19e 100644
> > > --- a/drivers/net/ethernet/mellanox/mlx4/main.c
> > > +++ b/drivers/net/ethernet/mellanox/mlx4/main.c
> > > @@ -3519,6 +3519,7 @@ static int mlx4_load_one(struct pci_dev *pdev,
> > int pci_dev_data,
> > >  				dev->flags = dev_flags;
> > >  				if (!SRIOV_VALID_STATE(dev->flags)) {
> > >  					mlx4_err(dev, "Invalid SRIOV state\n");
> > > +					err = -EINVAL;
> > >  					goto err_sriov;
> > >  				}
> > >  				err = mlx4_reset(dev);

> > [Severity: High]
> > Are there two more SR-IOV validation sites in mlx4_load_one() with the
> > same problem? Both jump to err_fw while err is still 0 from the
> > successful mlx4_QUERY_DEV_CAP() just before:

> > drivers/net/ethernet/mellanox/mlx4/main.c:mlx4_load_one() {
> >      ...
> > 			err = mlx4_QUERY_DEV_CAP(dev, dev_cap);
> > 			if (err) {
> > 				mlx4_err(dev, "QUERY_DEV_CAP command failed, aborting.\n");
> > 				goto err_fw;
> > 			}

> > 			if (mlx4_check_dev_cap(dev, dev_cap, nvfs))
> > 				goto err_fw;
> >      ...
> > }

> If there are more such cases, please fix them all in one go.

Actually

Please combine this patch with your separate mlx4_load_one() patch (both  
resolve the sibling sites flagged by Sashiko on each other) and include the  
discovery and testing information requested by netdev-bot+sinfo. If these  
legacy SR-IOV error paths are untested, please target [PATCH net-next] (now  
open) with Cc: stable+noautosel@kernel.org # untested fix to unlikely  
driver error path while keeping the Fixes and Reviewed-by tags.

> pw-bot: cr



  reply	other threads:[~2026-12-06  3:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30  3:14 [PATCH net] net/mlx4: fix missing error code in SR-IOV validation mdshahid03
2026-11-30  3:19 ` netdev-bot+sinfo
2026-11-30  3:21 ` sashiko-bot
2026-12-01  3:17 ` netdev-bot+sashiko
2026-12-06  2:30   ` willemb
2026-12-06  3:09     ` willemb [this message]
2026-12-01 17:23 ` Tariq Toukan
2026-12-01 17:38 ` Joe Damato

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=willemb.11a26608d0051@google.com \
    --to=willemb@google.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=jackm@dev.mellanox.co.il \
    --cc=kuba@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=matanb@mellanox.com \
    --cc=mdshahid03@gmail.com \
    --cc=netdev-bot+sashiko@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=ogerlitz@mellanox.com \
    --cc=pabeni@redhat.com \
    --cc=tariqt@nvidia.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