lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZC1x57v1JdUyK7aG@corigine.com>
Date:   Wed, 5 Apr 2023 15:04:39 +0200
From:   Simon Horman <simon.horman@...igine.com>
To:     Denis Plotnikov <den-plotnikov@...dex-team.ru>
Cc:     netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
        shshaikh@...vell.com, manishc@...vell.com,
        GR-Linux-NIC-Dev@...vell.com, davem@...emloft.net,
        edumazet@...gle.com, kuba@...nel.org, pabeni@...hat.com,
        Bjorn Helgaas <bhelgaas@...gle.com>, linux-pci@...r.kernel.org
Subject: Re: [PATCH] qlcnic: check pci_reset_function result

+ Bjorn Helgaas and linux-pci, as this is about FLR

On Mon, Apr 03, 2023 at 01:58:49PM +0300, Denis Plotnikov wrote:
> 
> On 31.03.2023 20:52, Simon Horman wrote:
> > On Fri, Mar 31, 2023 at 11:06:05AM +0300, Denis Plotnikov wrote:
> > > Static code analyzer complains to unchecked return value.
> > > It seems that pci_reset_function return something meaningful
> > > only if "reset_methods" is set.
> > > Even if reset_methods isn't used check the return value to avoid
> > > possible bugs leading to undefined behavior in the future.
> > > 
> > > Signed-off-by: Denis Plotnikov <den-plotnikov@...dex-team.ru>
> > nit: The tree this patch is targeted at should be designated, probably
> >       net-next, so the '[PATCH net-next]' in the subject.
> > 
> > > ---
> > >   drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c | 4 +++-
> > >   1 file changed, 3 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c
> > > index 87f76bac2e463..39ecfc1a1dbd0 100644
> > > --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c
> > > +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c
> > > @@ -628,7 +628,9 @@ int qlcnic_fw_create_ctx(struct qlcnic_adapter *dev)
> > >   	int i, err, ring;
> > >   	if (dev->flags & QLCNIC_NEED_FLR) {
> > > -		pci_reset_function(dev->pdev);
> > > +		err = pci_reset_function(dev->pdev);
> > > +		if (err && err != -ENOTTY)
> > Are you sure about the -ENOTTY part?
> > 
> > It seems odd to me that an FLR would be required but reset is not supported.
> No, I'm not sure. My logic is: if the reset method isn't set than
> pci_reset_function() returns -ENOTTY so treat that result as ok.
> pci_reset_function may return something different than -ENOTTY only if
> pci_reset_fn_methods[m].reset_fn is set.

I see your reasoning: -ENOTTY means nothing happened, and probably that is ok.
I think my main question is if that can ever happen.
If that is unknown, then I think this conservative approach makes sense.

Bjorn, do you happen to have any guidance here?

> > > +			return err;
> > >   		dev->flags &= ~QLCNIC_NEED_FLR;
> > >   	}
> > > -- 
> > > 2.25.1
> > > 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ