forked from GrapheneOS/linux-hardened
-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
63 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#include <linux/errno.h> | ||
#include <linux/init.h> | ||
#include <linux/kmemleak.h> | ||
#include <linux/sysctl.h> | ||
#include <linux/usb.h> | ||
|
||
static struct ctl_table usb_table[] = { | ||
{ | ||
.procname = "deny_new_usb", | ||
.data = &deny_new_usb, | ||
.maxlen = sizeof(int), | ||
.mode = 0644, | ||
.proc_handler = proc_dointvec_minmax_sysadmin, | ||
.extra1 = SYSCTL_ZERO, | ||
.extra2 = SYSCTL_ONE, | ||
}, | ||
{ } | ||
}; | ||
|
||
static struct ctl_table usb_root_table[] = { | ||
{ .procname = "kernel", | ||
.mode = 0555, | ||
.child = usb_table }, | ||
{ } | ||
}; | ||
|
||
static struct ctl_table_header *usb_table_header; | ||
|
||
int __init usb_init_sysctl(void) | ||
{ | ||
usb_table_header = register_sysctl_table(usb_root_table); | ||
if (!usb_table_header) { | ||
pr_warn("usb: sysctl registration failed\n"); | ||
return -ENOMEM; | ||
} | ||
|
||
kmemleak_not_leak(usb_table_header); | ||
return 0; | ||
} | ||
|
||
void usb_exit_sysctl(void) | ||
{ | ||
unregister_sysctl_table(usb_table_header); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters