The slram and phram drivers both allow mapping regions of physical
address space such that they can then be read and written by userland
through the MTD interface. This is probably usable to manipulate
hardware into overwriting kernel code on many systems. Prevent that
if locked down.
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Gbp-Pq: Topic features/all/lockdown
Gbp-Pq: Name mtd-disable-slram-and-phram-when-locked-down.patch
uint64_t len;
int i, ret;
+ if (kernel_is_locked_down("Command line-specified device addresses"))
+ return -EPERM;
+
if (strnlen(val, sizeof(buf)) >= sizeof(buf))
parse_err("parameter too long\n");
unsigned long devstart;
unsigned long devlength;
+ if (kernel_is_locked_down("Command line-specified device addresses"))
+ return -EPERM;
+
if ((!devname) || (!szstart) || (!szlength)) {
unregister_devices();
return(-EINVAL);