Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mtd: phram: Add the kernel lock down check

The phram MTD driver may map any memory pages no matter whether it's
reserved or whatever used for systems, which basically allows user
bypassing the lock down.

Add the check and abort the probe if the kernel is locked down for
LOCKDOWN_DEV_MEM.

Reported-by: Fabian Vogt <fvogt@suse.com>
Suggested-by: Fabian Vogt <fvogt@suse.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Acked-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>

authored by

Takashi Iwai and committed by
Miquel Raynal
b3c78286 78a56df6

+5
+5
drivers/mtd/devices/phram.c
··· 30 30 #include <linux/platform_device.h> 31 31 #include <linux/of_address.h> 32 32 #include <linux/of.h> 33 + #include <linux/security.h> 33 34 34 35 struct phram_mtd_list { 35 36 struct mtd_info mtd; ··· 410 409 static int __init init_phram(void) 411 410 { 412 411 int ret; 412 + 413 + ret = security_locked_down(LOCKDOWN_DEV_MEM); 414 + if (ret) 415 + return ret; 413 416 414 417 ret = platform_driver_register(&phram_driver); 415 418 if (ret)