]> git.baikalelectronics.ru Git - kernel.git/commit
spmi: pmic_arb: block access of invalid read and writes
authorAbhijeet Dharmapurikar <adharmap@codeaurora.org>
Wed, 10 May 2017 14:25:31 +0000 (19:55 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 3 Jun 2017 10:05:47 +0000 (19:05 +0900)
commit101d1a6c386af9e8c95efd9a6b3e1ae97460456c
treef42ab45d0bf31d8c2919217ca7bc7b44cd815014
parent1d0e25d2e2baac9353dde8946d351506cc8b5aa4
spmi: pmic_arb: block access of invalid read and writes

The system crashes due to bad access when reading from an non configured
peripheral and when writing to peripheral which is not owned by current
ee. This patch verifies ownership to avoid crashing on
write.
For reads, since the forward mapping table, data_channel->ppid, is
towards the end of the block, we use the core size to figure the
max number of ppids supported. The table starts at an offset of 0x800
within the block, so size - 0x800 will give us the area used by the
table. Since each table is 4 bytes long (core_size - 0x800) / 4 will
gives us the number of data_channel supported.
This new protection is functional on hw v2.

Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/spmi/spmi-pmic-arb.c