From: "Rodríguez Barbarin, José Javier" <JoseJavier.Rodriguez@duagon.com>
To: "morbidrsa@gmail.com" <morbidrsa@gmail.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: "jth@kernel.org" <jth@kernel.org>,
"Sanjuán García, Jorge" <Jorge.SanjuanGarcia@duagon.com>,
"Rodríguez Barbarin,
José Javier" <JoseJavier.Rodriguez@duagon.com>
Subject: [PATCH v3 0/3] mcb-pci: fix memory overlapping on MCB devices
Date: Thu, 30 Mar 2023 10:50:01 +0000 [thread overview]
Message-ID: <20230330104949.21918-1-josejavier.rodriguez@duagon.com> (raw)
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 V3:
* handle return value if no chameleon cells found.
* remove stray newline.
* reword typo in PATCH 1 commit message.
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 | 15 ++++++++++-----
drivers/mcb/mcb-pci.c | 27 +++++++++++++++++++++++++--
3 files changed, 66 insertions(+), 11 deletions(-)
--
2.34.1
next reply other threads:[~2023-03-30 10:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-30 10:50 Rodríguez Barbarin, José Javier [this message]
2023-03-30 10:50 ` [PATCH v3 1/3] mcb: Return actual parsed size when reading chameleon table Rodríguez Barbarin, José Javier
2023-03-30 10:50 ` [PATCH v3 2/3] mcb-pci: Reallocate memory region to avoid memory overlapping Rodríguez Barbarin, José Javier
2023-03-30 10:50 ` [PATCH v3 3/3] mcb-lpc: " Rodríguez Barbarin, José Javier
2023-03-30 14:53 ` [PATCH v3 0/3] mcb-pci: fix memory overlapping on MCB devices Johannes Thumshirn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230330104949.21918-1-josejavier.rodriguez@duagon.com \
--to=josejavier.rodriguez@duagon.com \
--cc=Jorge.SanjuanGarcia@duagon.com \
--cc=jth@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=morbidrsa@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®