linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PCI: fix a scheduling in atomic bug
@ 2021-08-12  7:00 Dan Carpenter
  2021-08-12 15:19 ` Logan Gunthorpe
  2021-08-12 19:16 ` Bjorn Helgaas
  0 siblings, 2 replies; 4+ messages in thread
From: Dan Carpenter @ 2021-08-12  7:00 UTC (permalink / raw)
  To: Bjorn Helgaas, Logan Gunthorpe
  Cc: Alex Williamson, Christian König, Stephen Bates, linux-pci,
	kernel-janitors

This function 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: 07d8d7e57c28 ("PCI: Make specifying PCI devices in kernel parameters reusable")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/pci/pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 6714c58ce321..71baf5ff48fc 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -269,7 +269,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;
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] PCI: fix a scheduling in atomic bug
  2021-08-12  7:00 [PATCH] PCI: fix a scheduling in atomic bug Dan Carpenter
@ 2021-08-12 15:19 ` Logan Gunthorpe
  2021-08-13  7:27   ` Dan Carpenter
  2021-08-12 19:16 ` Bjorn Helgaas
  1 sibling, 1 reply; 4+ messages in thread
From: Logan Gunthorpe @ 2021-08-12 15:19 UTC (permalink / raw)
  To: Dan Carpenter, Bjorn Helgaas
  Cc: Alex Williamson, Christian König, Stephen Bates, linux-pci,
	kernel-janitors




On 2021-08-12 1:00 a.m., Dan Carpenter wrote:
> This function 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: 07d8d7e57c28 ("PCI: Make specifying PCI devices in kernel parameters reusable")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

This looks good to me, but I think the fixes tag is wrong.
pci_dev_str_match_path() was introduced in this patch:

Fixes: 45db33709ccc ("PCI: Allow specifying devices using a base bus and
path of devfns")

Reviewed-by: Logan Gunthorpe <logang@deltatee.com>

Thanks,

Logan

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] PCI: fix a scheduling in atomic bug
  2021-08-12  7:00 [PATCH] PCI: fix a scheduling in atomic bug Dan Carpenter
  2021-08-12 15:19 ` Logan Gunthorpe
@ 2021-08-12 19:16 ` Bjorn Helgaas
  1 sibling, 0 replies; 4+ messages in thread
From: Bjorn Helgaas @ 2021-08-12 19:16 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Bjorn Helgaas, Logan Gunthorpe, Alex Williamson,
	Christian König, Stephen Bates, linux-pci, kernel-janitors

On Thu, Aug 12, 2021 at 10:00:04AM +0300, Dan Carpenter wrote:
> This function 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: 07d8d7e57c28 ("PCI: Make specifying PCI devices in kernel parameters reusable")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied with Logan's Reviewed-by and Fixes: update to pci/misc for
v5.15, thanks!

> ---
>  drivers/pci/pci.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index 6714c58ce321..71baf5ff48fc 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -269,7 +269,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;
>  
> -- 
> 2.20.1
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] PCI: fix a scheduling in atomic bug
  2021-08-12 15:19 ` Logan Gunthorpe
@ 2021-08-13  7:27   ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2021-08-13  7:27 UTC (permalink / raw)
  To: Logan Gunthorpe
  Cc: Bjorn Helgaas, Alex Williamson, Christian König,
	Stephen Bates, linux-pci, kernel-janitors

On Thu, Aug 12, 2021 at 09:19:42AM -0600, Logan Gunthorpe wrote:
> 
> 
> 
> On 2021-08-12 1:00 a.m., Dan Carpenter wrote:
> > This function 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: 07d8d7e57c28 ("PCI: Make specifying PCI devices in kernel parameters reusable")
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> This looks good to me, but I think the fixes tag is wrong.
> pci_dev_str_match_path() was introduced in this patch:
> 
> Fixes: 45db33709ccc ("PCI: Allow specifying devices using a base bus and
> path of devfns")

Yeah.  You're right.  Thanks.  Thanks, Bjorn for fixing this.

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-08-13  7:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-12  7:00 [PATCH] PCI: fix a scheduling in atomic bug Dan Carpenter
2021-08-12 15:19 ` Logan Gunthorpe
2021-08-13  7:27   ` Dan Carpenter
2021-08-12 19:16 ` Bjorn Helgaas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).