mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
spmi: spmi-pmic-arb: block access for invalid PMIC arbiter v5 SPMI writes
The system crashes due to an access permission violation when writing to a PMIC peripheral which is not owned by the current ee. Add a check for PMIC arbiter version 5 for such invalid write requests and return an error instead of crashing the system. Change-Id: If601a8c737f10be2a7d1e894f7285cf0de4eb4a5 Signed-off-by: David Collins <[email protected]>
This commit is contained in:
parent
27abf44b3c
commit
0cf5f1b07b
1 changed files with 5 additions and 0 deletions
|
|
@ -1016,6 +1016,11 @@ static int pmic_arb_offset_v5(struct spmi_pmic_arb *pmic_arb, u8 sid, u16 addr,
|
|||
offset = 0x10000 * pmic_arb->ee + 0x80 * apid;
|
||||
break;
|
||||
case PMIC_ARB_CHANNEL_RW:
|
||||
if (pmic_arb->apid_data[apid].write_ee != pmic_arb->ee) {
|
||||
dev_err(&pmic_arb->spmic->dev, "disallowed SPMI write to sid=%u, addr=0x%04X\n",
|
||||
sid, addr);
|
||||
return -EPERM;
|
||||
}
|
||||
offset = 0x10000 * apid;
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue