aboutsummaryrefslogtreecommitdiffstats
path: root/security/root_plug.c
diff options
context:
space:
mode:
Diffstat (limited to 'security/root_plug.c')
-rw-r--r--security/root_plug.c31
1 files changed, 1 insertions, 30 deletions
diff --git a/security/root_plug.c b/security/root_plug.c
index 38dd4f3e641f..870f13095bb6 100644
--- a/security/root_plug.c
+++ b/security/root_plug.c
@@ -22,11 +22,11 @@
22 * License. 22 * License.
23 */ 23 */
24 24
25#include <linux/module.h>
26#include <linux/kernel.h> 25#include <linux/kernel.h>
27#include <linux/init.h> 26#include <linux/init.h>
28#include <linux/security.h> 27#include <linux/security.h>
29#include <linux/usb.h> 28#include <linux/usb.h>
29#include <linux/moduleparam.h>
30 30
31/* flag to keep track of how we were registered */ 31/* flag to keep track of how we were registered */
32static int secondary; 32static int secondary;
@@ -36,22 +36,14 @@ static int vendor_id = 0x0557;
36static int product_id = 0x2008; 36static int product_id = 0x2008;
37 37
38module_param(vendor_id, uint, 0400); 38module_param(vendor_id, uint, 0400);
39MODULE_PARM_DESC(vendor_id, "USB Vendor ID of device to look for");
40
41module_param(product_id, uint, 0400); 39module_param(product_id, uint, 0400);
42MODULE_PARM_DESC(product_id, "USB Product ID of device to look for");
43 40
44/* should we print out debug messages */ 41/* should we print out debug messages */
45static int debug = 0; 42static int debug = 0;
46 43
47module_param(debug, bool, 0600); 44module_param(debug, bool, 0600);
48MODULE_PARM_DESC(debug, "Debug enabled or not");
49 45
50#if defined(CONFIG_SECURITY_ROOTPLUG_MODULE)
51#define MY_NAME THIS_MODULE->name
52#else
53#define MY_NAME "root_plug" 46#define MY_NAME "root_plug"
54#endif
55 47
56#define root_dbg(fmt, arg...) \ 48#define root_dbg(fmt, arg...) \
57 do { \ 49 do { \
@@ -117,25 +109,4 @@ static int __init rootplug_init (void)
117 return 0; 109 return 0;
118} 110}
119 111
120static void __exit rootplug_exit (void)
121{
122 /* remove ourselves from the security framework */
123 if (secondary) {
124 if (mod_unreg_security (MY_NAME, &rootplug_security_ops))
125 printk (KERN_INFO "Failure unregistering Root Plug "
126 " module with primary module.\n");
127 } else {
128 if (unregister_security (&rootplug_security_ops)) {
129 printk (KERN_INFO "Failure unregistering Root Plug "
130 "module with the kernel\n");
131 }
132 }
133 printk (KERN_INFO "Root Plug module removed\n");
134}
135
136security_initcall (rootplug_init); 112security_initcall (rootplug_init);
137module_exit (rootplug_exit);
138
139MODULE_DESCRIPTION("Root Plug sample LSM module, written for Linux Journal article");
140MODULE_LICENSE("GPL");
141