* [PATCH] PCI: Fix minimum allocation address overwrite
@ 2015-12-23 15:51 Christoph Biedl
2016-01-06 21:49 ` Bjorn Helgaas
0 siblings, 1 reply; 2+ messages in thread
From: Christoph Biedl @ 2015-12-23 15:51 UTC (permalink / raw)
To: Bjorn Helgaas, linux-pci
Commit 36e097a8a297 ("PCI: Split out bridge window override of minimum
allocation address") claimed to do no functional changes but unfortunately
did: The "min" variable is altered. At least the AVM A1 PCMCIA adapter was
no longer detected, breaking ISDN operation.
So use a local copy of min to restore the previous behaviour.
Cc: stable@vger.kernel.org # v3.14+
Fixes: 36e097a8a297 ("PCI: Split out bridge window override of minimum allocation address")
Signed-off-by: Christoph Biedl <linux-kernel.bfrz@manchmal.in-ulm.de>
---
Since I have access to that piece of hardware for a limited time only,
please get back to ASAP in case I should do more tests, by 2015-12-26
the latest.
Additional tests were done for -stable on the latest 3.14, 4.1 and 4.3
releases, with all results as expected.
---
drivers/pci/bus.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c
index d3346d2..60263f7 100644
--- a/drivers/pci/bus.c
+++ b/drivers/pci/bus.c
@@ -140,6 +140,8 @@ static int pci_bus_alloc_from_region(struct pci_bus *bus, struct resource *res,
type_mask |= IORESOURCE_TYPE_BITS;
pci_bus_for_each_resource(bus, r, i) {
+ resource_size_t min_used;
+
if (!r)
continue;
@@ -162,13 +164,11 @@ static int pci_bus_alloc_from_region(struct pci_bus *bus, struct resource *res,
* this is an already-configured bridge window, its start
* overrides "min".
*/
- if (avail.start)
- min = avail.start;
-
+ min_used = avail.start ? : min;
max = avail.end;
/* Ok, try it out.. */
- ret = allocate_resource(r, res, size, min, max,
+ ret = allocate_resource(r, res, size, min_used, max,
align, alignf, alignf_data);
if (ret == 0)
return 0;
--
1.7.10.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] PCI: Fix minimum allocation address overwrite
2015-12-23 15:51 [PATCH] PCI: Fix minimum allocation address overwrite Christoph Biedl
@ 2016-01-06 21:49 ` Bjorn Helgaas
0 siblings, 0 replies; 2+ messages in thread
From: Bjorn Helgaas @ 2016-01-06 21:49 UTC (permalink / raw)
To: Christoph Biedl; +Cc: Bjorn Helgaas, linux-pci
On Wed, Dec 23, 2015 at 04:51:57PM +0100, Christoph Biedl wrote:
> Commit 36e097a8a297 ("PCI: Split out bridge window override of minimum
> allocation address") claimed to do no functional changes but unfortunately
> did: The "min" variable is altered. At least the AVM A1 PCMCIA adapter was
> no longer detected, breaking ISDN operation.
>
> So use a local copy of min to restore the previous behaviour.
>
> Cc: stable@vger.kernel.org # v3.14+
> Fixes: 36e097a8a297 ("PCI: Split out bridge window override of minimum allocation address")
> Signed-off-by: Christoph Biedl <linux-kernel.bfrz@manchmal.in-ulm.de>
Applied to pci/misc for v4.5, thanks!
I don't think the problem is specific to the AVM A1 adapter; it is probably
related to the specific system memory layout and maybe PCMCIA. If you have
more information, e.g., a dmesg log and /proc/iomem contents, that would be
useful documentation.
> ---
> Since I have access to that piece of hardware for a limited time only,
> please get back to ASAP in case I should do more tests, by 2015-12-26
> the latest.
>
> Additional tests were done for -stable on the latest 3.14, 4.1 and 4.3
> releases, with all results as expected.
> ---
> drivers/pci/bus.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c
> index d3346d2..60263f7 100644
> --- a/drivers/pci/bus.c
> +++ b/drivers/pci/bus.c
> @@ -140,6 +140,8 @@ static int pci_bus_alloc_from_region(struct pci_bus *bus, struct resource *res,
> type_mask |= IORESOURCE_TYPE_BITS;
>
> pci_bus_for_each_resource(bus, r, i) {
> + resource_size_t min_used;
> +
> if (!r)
> continue;
>
> @@ -162,13 +164,11 @@ static int pci_bus_alloc_from_region(struct pci_bus *bus, struct resource *res,
> * this is an already-configured bridge window, its start
> * overrides "min".
> */
> - if (avail.start)
> - min = avail.start;
> -
> + min_used = avail.start ? : min;
> max = avail.end;
>
> /* Ok, try it out.. */
> - ret = allocate_resource(r, res, size, min, max,
> + ret = allocate_resource(r, res, size, min_used, max,
> align, alignf, alignf_data);
> if (ret == 0)
> return 0;
> --
> 1.7.10.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-01-06 21:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-23 15:51 [PATCH] PCI: Fix minimum allocation address overwrite Christoph Biedl
2016-01-06 21:49 ` 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).