Skip to content

Commit 3f19cad

Browse files
dhowellsxjamesmorris
authored andcommitted
lockdown: Prohibit PCMCIA CIS storage when the kernel is locked down
Prohibit replacement of the PCMCIA Card Information Structure when the kernel is locked down. Suggested-by: Dominik Brodowski <linux@dominikbrodowski.net> Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Matthew Garrett <mjg59@google.com> Reviewed-by: Kees Cook <keescook@chromium.org> Signed-off-by: James Morris <jmorris@namei.org>
1 parent 6ea0e81 commit 3f19cad

3 files changed

Lines changed: 7 additions & 0 deletions

File tree

‎drivers/pcmcia/cistpl.c‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <linux/pci.h>
2222
#include <linux/ioport.h>
2323
#include <linux/io.h>
24+
#include <linux/security.h>
2425
#include <asm/byteorder.h>
2526
#include <asm/unaligned.h>
2627

@@ -1575,6 +1576,10 @@ static ssize_t pccard_store_cis(struct file *filp, struct kobject *kobj,
15751576
struct pcmcia_socket *s;
15761577
int error;
15771578

1579+
error = security_locked_down(LOCKDOWN_PCMCIA_CIS);
1580+
if (error)
1581+
return error;
1582+
15781583
s = to_socket(container_of(kobj, struct device, kobj));
15791584

15801585
if (off)

‎include/linux/security.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ enum lockdown_reason {
111111
LOCKDOWN_IOPORT,
112112
LOCKDOWN_MSR,
113113
LOCKDOWN_ACPI_TABLES,
114+
LOCKDOWN_PCMCIA_CIS,
114115
LOCKDOWN_INTEGRITY_MAX,
115116
LOCKDOWN_CONFIDENTIALITY_MAX,
116117
};

‎security/lockdown/lockdown.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ static char *lockdown_reasons[LOCKDOWN_CONFIDENTIALITY_MAX+1] = {
2626
[LOCKDOWN_IOPORT] = "raw io port access",
2727
[LOCKDOWN_MSR] = "raw MSR access",
2828
[LOCKDOWN_ACPI_TABLES] = "modifying ACPI tables",
29+
[LOCKDOWN_PCMCIA_CIS] = "direct PCMCIA CIS storage",
2930
[LOCKDOWN_INTEGRITY_MAX] = "integrity",
3031
[LOCKDOWN_CONFIDENTIALITY_MAX] = "confidentiality",
3132
};

0 commit comments

Comments
 (0)