diff options
author | Logan Gunthorpe <logang@deltatee.com> | 2021-06-10 10:06:05 -0600 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2021-06-10 18:01:41 -0500 |
commit | e4ece59abd70d8f54e2163274dc996bb442832a6 (patch) | |
tree | 9b8c0159fbd6f5a66a2ac779752ea052344d36e5 /drivers/pci/pci-pf-stub.c | |
parent | 6389d43745228de128e7b1a66eb18c0ccf43e6b4 (diff) |
PCI/P2PDMA: Collect acs list in stack buffer to avoid sleeping
In order to call the calc_map_type_and_dist_warn() function from a dma_map
operation, the function must not sleep. The only reason it sleeps is to
allocate memory for the seq_buf to print a verbose warning telling the user
how to disable ACS for that path.
Instead of allocating the memory with kmalloc(), allocate a smaller buffer
on the stack. A 128 byte buffer is enough to print 10 PCI device names. A
system with 10 bridge ports between two devices that have ACS enabled would
be unusually large, so this should still be a reasonable limit.
This also cleans up the awkward (and broken) return with -ENOMEM which
contradicts the return type and the caller was not prepared for.
Link: https://lore.kernel.org/r/20210610160609.28447-3-logang@deltatee.com
Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/pci/pci-pf-stub.c')
0 files changed, 0 insertions, 0 deletions