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] [day] [month] [year] [list]
Date:   Fri, 26 Feb 2021 23:22:20 +0800
From:   Dejin Zheng <zhengdejin5@...il.com>
To:     Robert Richter <rric@...nel.org>
Cc:     corbet@....net, jarkko.nikula@...ux.intel.com,
        andriy.shevchenko@...ux.intel.com, mika.westerberg@...ux.intel.com,
        bhelgaas@...gle.com, wsa@...nel.org, linux-doc@...r.kernel.org,
        linux-i2c@...r.kernel.org, linux-pci@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4 1/4] PCI: Introduce pcim_alloc_irq_vectors()

On Thu, Feb 25, 2021 at 10:33:53AM +0100, Robert Richter wrote:
> On 23.02.21 22:14:35, Dejin Zheng wrote:
> > On Tue, Feb 23, 2021 at 09:02:54AM +0100, Robert Richter wrote:
> > > On 22.02.21 23:14:15, Dejin Zheng wrote:
> > > > On Mon, Feb 22, 2021 at 11:56:08AM +0100, Robert Richter wrote:
> > > > > On 20.02.21 00:46:49, Dejin Zheng wrote:
> > > > > > > On 18.02.21 23:04:55, Dejin Zheng wrote:
> > > > > 
> > > > > > > > +	if (!dr || !dr->enabled)
> > > > > > here checks whether the pci device is enabled.
> > > > > 
> > > > > What is the purpose of this? The device "is_managed" or not.
> > > > >
> > > > The device is managed or not by check whether "dr" is NULL. And
> > > > check the "dr->enabled" is for the PCI device enable. I think it
> > > > may not make sense to apply for irq vectors when PCI device is not
> > > > enabled.
> > > 
> > > I don't see how a disabled device affects in any way the release of
> > > the irq vectors during device removal. dr is always non-null in case
> > > the device is managed, a check isn't needed for that.
> > >
> > Yes, the disabled device does not affect release irq vectors, But
> > the disabled device affects apply for irq vectors, It is wrong to apply
> > for the irq vectors when the device is not enabled.
> 
> What is the scenario you have in mind here? What does happen then?
> The typical use case is to pcim_enable_device() it and then add the
> irq vectors. It is always enabled then.
> 
> Even if the device could wrongly be disabled, it does not affect the
> device's release.
> 
> Also, how is this related to pcim? There isn't a check in
> pci_alloc_irq_vectors() either for that case. 
> 
> > Add this check can
> > facilitate developers to find problems as soon as possible.
> 
> No, there are many ways to shoot yourself in the foot. We cannot add
> checks here and there for this, esp. at runtime. If there is a valid
> reason that the device must always be enabled and we cannot assume
> this is the case, then we could add a WARN_ON(). But I doubt that.
>
Robert, You are right, I will remove the enable check. Thanks!

BR,
Dejin
> -Robert

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ