From: Dan Carpenter Date: Thu, 12 Aug 2021 07:00:04 +0000 (+0300) Subject: PCI: Fix pci_dev_str_match_path() alloc while atomic bug X-Git-Tag: v4.19.207~12 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=1a091bfd11e61032b6192cf2a1ebb259889f28b3;p=users%2Fdwmw2%2Flinux.git PCI: Fix pci_dev_str_match_path() alloc while atomic bug [ Upstream commit 7eb6ea4148579b85540a41d57bcec315b8af8ff8 ] pci_dev_str_match_path() is often called with a spinlock held so the allocation has to be atomic. The call tree is: pci_specified_resource_alignment() <-- takes spin_lock(); pci_dev_str_match() pci_dev_str_match_path() Fixes: 45db33709ccc ("PCI: Allow specifying devices using a base bus and path of devfns") Link: https://lore.kernel.org/r/20210812070004.GC31863@kili Signed-off-by: Dan Carpenter Signed-off-by: Bjorn Helgaas Reviewed-by: Logan Gunthorpe Signed-off-by: Sasha Levin --- diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 077cc0512dd25..97d69b9be1d49 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -224,7 +224,7 @@ static int pci_dev_str_match_path(struct pci_dev *dev, const char *path, *endptr = strchrnul(path, ';'); - wpath = kmemdup_nul(path, *endptr - path, GFP_KERNEL); + wpath = kmemdup_nul(path, *endptr - path, GFP_ATOMIC); if (!wpath) return -ENOMEM;