Skip to content

Commit b3c7828

Browse files
tiwaimiquelraynal
authored andcommitted
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 <[email protected]> Suggested-by: Fabian Vogt <[email protected]> Signed-off-by: Takashi Iwai <[email protected]> Acked-by: Richard Weinberger <[email protected]> Signed-off-by: Miquel Raynal <[email protected]>
1 parent 78a56df commit b3c7828

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/mtd/devices/phram.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include <linux/platform_device.h>
3131
#include <linux/of_address.h>
3232
#include <linux/of.h>
33+
#include <linux/security.h>
3334

3435
struct phram_mtd_list {
3536
struct mtd_info mtd;
@@ -410,6 +411,10 @@ static int __init init_phram(void)
410411
{
411412
int ret;
412413

414+
ret = security_locked_down(LOCKDOWN_DEV_MEM);
415+
if (ret)
416+
return ret;
417+
413418
ret = platform_driver_register(&phram_driver);
414419
if (ret)
415420
return ret;

0 commit comments

Comments
 (0)