Messages in this thread | | | From | Rodríguez Barbarin, José Javier <> | Subject | [PATCH v2 0/3] mcb-pci: fix memory overlapping on MCB devices | Date | Tue, 28 Mar 2023 14:34:52 +0000 |
| |
mcb-pci driver is allocating the memory region for the "chameleon table" with a fixed size of 0x200. This region is only use to do a initial parsing to discover the devices implemented as IP Cores.
If the "chameleon table" is actually smalled than 0x200 and the first device offset happen to be within 0x200, a memory overlapping can ocurr.
Here an extract of the memory overlapping when registering a 16z125 IP Core:
[ 31.016972] 8250_men_mcb mcb0-16z125-0:0:0: can't request region for resource [mem 0xa8200100-0xa820010f] [ 31.016994] 8250_men_mcb: probe of mcb0-16z125-0:0:0 failed with error -16 [ 31.017010] 8250_men_mcb mcb0-16z125-1:0:0: can't request region for resource [mem 0xa8200110-0xa820011f]
And here, the memory allocated for the chameleon table parsing:
user@host:$ sudo /proc/iomem ... a8200000-a82001ff : mcb_pci ...
This patch solves this problem by dropping/reallocating the memory region of the "chamelon table" with the actual size once it has been parsed.
This patch is based on linux-next (next-20230323)
Changes for V2: * make parsing function return the size of "chameleon table". * reallocate instead of not requesting the memory region.
Javier Rodriguez (3): mcb: Return actual parsed size when reading chameleon table mcb-pci: Reallocate memory region to avoid memory overlapping mcb-lpc: Reallocate memory region to avoid memory overlapping
drivers/mcb/mcb-lpc.c | 35 +++++++++++++++++++++++++++++++---- drivers/mcb/mcb-parse.c | 10 +++++++--- drivers/mcb/mcb-pci.c | 27 +++++++++++++++++++++++++-- 3 files changed, 63 insertions(+), 9 deletions(-)
-- 2.34.1
| |