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: <CAErSpo4WAbb=n+cNARRgKWPhbn6LZqwL-htB_Uv2OWB9BwTXpw@mail.gmail.com>
Date:	Thu, 11 Dec 2014 14:00:06 -0700
From:	Bjorn Helgaas <bhelgaas@...gle.com>
To:	Guenter Roeck <groeck@...iper.net>
Cc:	Rajat Jain <rajatxjain@...il.com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"linux-pci@...r.kernel.org" <linux-pci@...r.kernel.org>,
	Rajat Jain <rajatjain@...iper.net>
Subject: Re: [PATCH v2] PCI: pciehp: Check link state before accessing device
 during removal

On Thu, Dec 11, 2014 at 1:45 PM, Guenter Roeck <groeck@...iper.net> wrote:
> On Thu, Dec 11, 2014 at 01:26:47PM -0700, Bjorn Helgaas wrote:
>> On Thu, Dec 11, 2014 at 9:38 AM, Guenter Roeck <groeck@...iper.net> wrote:
>> > On Wed, Dec 10, 2014 at 05:26:30PM -0700, Bjorn Helgaas wrote:
>> >> On Thu, Nov 20, 2014 at 02:54:24PM -0800, Rajat Jain wrote:

>> >> If we do need it (and it looks like most or all hotplug drivers copied it),
>> >> isn't there still a race?  Can't we have the following sequence?
>> >>
>> >>   - pciehp_check_link_active()                # returns true
>> >>   - Link goes down
>> >>   - pci_read_config_byte()            # fails because link is down
>> >>
>> > I would guess so. Question is how to address it. Read the configuration byte
>> > first, then check if the link is down ? Check if link is still up after reading
>> > the configuration byte ? Add a note that there may be a potential race condition
>> > and do nothing until it is actually seen ?
>>
>> I think we should just read PCI_BRIDGE_CONTROL and look for a 0xff
>> value.  That's not a legal value for the register, so if we see it, it
>> should be pretty safe to assume the link is down or the device is not
>> present at all.
>>
> Something like
>         if (bctl != 0xff && (bctl & PCI_BRIDGE_CTL_VGA)) {
> in addition to Rajat's changes ?
>
> I think it would be good to keep the change Rajat proposed, ie to check
> the link state instead of presence. Question then is if you'd want a new
> revision of Rajat's patch or another patch on top of it with the bctl
> related change.

Why do we need the link state or the presence check?  It seems like
those are sort of a 90% solution, and doing them provides the illusion
of value but without real value.  If we think that checking for 0xff
is a 100% solution, we should rely on that and not bother with
anything else.

Bjorn
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ