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: <20191024093803.GU2819@lahna.fi.intel.com>
Date:   Thu, 24 Oct 2019 12:38:03 +0300
From:   Mika Westerberg <mika.westerberg@...ux.intel.com>
To:     Bjorn Helgaas <helgaas@...nel.org>
Cc:     "Rafael J. Wysocki" <rjw@...ysocki.net>,
        Lukas Wunner <lukas@...ner.de>,
        Keith Busch <keith.busch@...el.com>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        Frederick Lawler <fred@...dlawl.com>,
        "Gustavo A . R . Silva" <gustavo@...eddedor.com>,
        Sinan Kaya <okaya@...nel.org>,
        Kai-Heng Feng <kai.heng.feng@...onical.com>,
        linux-pci@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 2/2] PCI: pciehp: Prevent deadlock on disconnect

On Wed, Oct 23, 2019 at 10:52:53AM +0300, Mika Westerberg wrote:
> > Shouldn't we check for slot_status being an error response (~0)
> > instead of looking for PCIBIOS_DEVICE_NOT_FOUND?  There are 7 RsvdP
> > bits in Slot Status, so ~0 is not a valid value for the register.
> > 
> > All 16 bits of Link Status are defined, but ~0 is still an invalid
> > value because the Current Link Speed and Negotiated Link Width fields
> > only define a few valid encodings.
> 
> Indeed that's a good point. I'll try that.

Just checking if I understand correctly what you are suggesting.

Currently we use pcie_capability_read_word() and check the return value.
If the device is gone it returns an error and resets *val to 0. That
only works if pci_dev_is_disconnected() is true so we would need to do
something like below.

pciehp_check_link_active():

	ret = pcie_capability_read_word(pdev, PCI_EXP_LNKSTA, &lnk_status);
	if (ret == PCIBIOS_DEVICE_NOT_FOUND || lnk_status == (u16)~0)
		return -ENODEV;

Or you mean that we check only for ~0 in which case we either need to
use pci_read_config_word() directly here or modify pcie_capability_read_word()
return ~0 instead of clearing it?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ