Linux PCI subsystem development
 help / color / mirror / Atom feed
From: Dave Jiang <dave.jiang@intel.com>
To: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	"Lukas Wunner" <lukas@wunner.de>,
	"Moshe Shemesh" <moshe@nvidia.com>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"Dan Williams" <dan.j.williams@intel.com>,
	"Keith Busch" <kbusch@kernel.org>,
	linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: stable@vger.kernel.org
Subject: Re: [PATCH v2 1/1] PCI: Fix lock symmetry in pci_slot_unlock()
Date: Mon, 5 May 2025 08:05:02 -0700	[thread overview]
Message-ID: <1f315645-4afd-49f1-b259-bac8911dd67a@intel.com> (raw)
In-Reply-To: <20250505115412.37628-1-ilpo.jarvinen@linux.intel.com>



On 5/5/25 4:54 AM, Ilpo Järvinen wrote:
> The commit a4e772898f8b ("PCI: Add missing bridge lock to
> pci_bus_lock()") made the lock function to call depend on
> dev->subordinate but left pci_slot_unlock() unmodified creating locking
> asymmetry compared with pci_slot_lock().
> 
> Because of the asymmetric lock handling, the same bridge device is
> unlocked twice. First pci_bus_unlock() unlocks bus->self and then
> pci_slot_unlock() will unconditionally unlock the same bridge device.
> 
> Move pci_dev_unlock() inside an else branch to match the logic in
> pci_slot_lock().
> 
> Fixes: a4e772898f8b ("PCI: Add missing bridge lock to pci_bus_lock()")
> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> Cc: <stable@vger.kernel.org>

Reviewed-by: Dave Jiang <dave.jiang@intel.com>
> ---
> 
> v2:
> - Improve changelog (Lukas)
> - Added Cc stable
> 
>  drivers/pci/pci.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index 4d7c9f64ea24..26507aa906d7 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -5542,7 +5542,8 @@ static void pci_slot_unlock(struct pci_slot *slot)
>  			continue;
>  		if (dev->subordinate)
>  			pci_bus_unlock(dev->subordinate);
> -		pci_dev_unlock(dev);
> +		else
> +			pci_dev_unlock(dev);
>  	}
>  }
>  
> 
> base-commit: 0af2f6be1b4281385b618cb86ad946eded089ac8


  parent reply	other threads:[~2025-05-05 15:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-05 11:54 [PATCH v2 1/1] PCI: Fix lock symmetry in pci_slot_unlock() Ilpo Järvinen
2025-05-05 12:57 ` Lukas Wunner
2025-05-05 15:05 ` Dave Jiang [this message]
2025-05-05 20:04 ` Bjorn Helgaas

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=1f315645-4afd-49f1-b259-bac8911dd67a@intel.com \
    --to=dave.jiang@intel.com \
    --cc=bhelgaas@google.com \
    --cc=dan.j.williams@intel.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=kbusch@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=moshe@nvidia.com \
    --cc=stable@vger.kernel.org \
    /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