]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commit
net: ipa: memory region array is variable size
authorAlex Elder <elder@linaro.org>
Tue, 11 May 2021 19:42:04 +0000 (14:42 -0500)
committerStefan Bader <stefan.bader@canonical.com>
Wed, 30 Jun 2021 06:27:32 +0000 (08:27 +0200)
commit0a2d9a99d086629dfd6f1e6b18bfde0b714441d6
tree6a33d9009f98664dfdc2a03a06095e32dbb7a2ae
parentace6373573ca180f342cce481ec551937d515a82
net: ipa: memory region array is variable size

BugLink: https://bugs.launchpad.net/bugs/1931896
[ Upstream commit 440c3247cba3d9433ac435d371dd7927d68772a7 ]

IPA configuration data includes an array of memory region
descriptors.  That was a fixed-size array at one time, but
at some point we started defining it such that it was only
as big as required for a given platform.  The actual number
of entries in the array is recorded in the configuration data
along with the array.

A loop in ipa_mem_config() still assumes the array has entries
for all defined memory region IDs.  As a result, this loop can
go past the end of the actual array and attempt to write
"canary" values based on nonsensical data.

Fix this, by stashing the number of entries in the array, and
using that rather than IPA_MEM_COUNT in the initialization loop
found in ipa_mem_config().

The only remaining use of IPA_MEM_COUNT is in a validation check
to ensure configuration data doesn't have too many entries.
That's fine for now.

Fixes: 3128aae8c439a ("net: ipa: redefine struct ipa_mem_data")
Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kelsey Skunberg <kelsey.skunberg@canonical.com>
drivers/net/ipa/ipa.h
drivers/net/ipa/ipa_mem.c