SELinux: avc: remove the useless fields in avc_add_callback
authorWanlong Gao <gaowanlong@cn.fujitsu.com>
Wed, 7 Mar 2012 14:17:14 +0000 (22:17 +0800)
committerEric Paris <eparis@redhat.com>
Mon, 9 Apr 2012 16:23:44 +0000 (12:23 -0400)
avc_add_callback now just used for registering reset functions
in initcalls, and the callback functions just did reset operations.
So, reducing the arguments to only one event is enough now.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
Signed-off-by: Eric Paris <eparis@redhat.com>
security/selinux/avc.c
security/selinux/include/avc.h
security/selinux/netif.c
security/selinux/netnode.c
security/selinux/netport.c
security/selinux/ss/services.c

index 5c1326e18836ed81e5037acb3667ea642054268a..68d82daed257db766c57bed57d1768866207d253 100644 (file)
@@ -65,14 +65,8 @@ struct avc_cache {
 };
 
 struct avc_callback_node {
-       int (*callback) (u32 event, u32 ssid, u32 tsid,
-                        u16 tclass, u32 perms,
-                        u32 *out_retained);
+       int (*callback) (u32 event);
        u32 events;
-       u32 ssid;
-       u32 tsid;
-       u16 tclass;
-       u32 perms;
        struct avc_callback_node *next;
 };
 
@@ -499,22 +493,12 @@ noinline int slow_avc_audit(u32 ssid, u32 tsid, u16 tclass,
  * avc_add_callback - Register a callback for security events.
  * @callback: callback function
  * @events: security events
- * @ssid: source security identifier or %SECSID_WILD
- * @tsid: target security identifier or %SECSID_WILD
- * @tclass: target security class
- * @perms: permissions
  *
- * Register a callback function for events in the set @events
- * related to the SID pair (@ssid, @tsid) 
- * and the permissions @perms, interpreting
- * @perms based on @tclass.  Returns %0 on success or
- * -%ENOMEM if insufficient memory exists to add the callback.
+ * Register a callback function for events in the set @events.
+ * Returns %0 on success or -%ENOMEM if insufficient memory
+ * exists to add the callback.
  */
-int __init avc_add_callback(int (*callback)(u32 event, u32 ssid, u32 tsid,
-                                    u16 tclass, u32 perms,
-                                    u32 *out_retained),
-                    u32 events, u32 ssid, u32 tsid,
-                    u16 tclass, u32 perms)
+int __init avc_add_callback(int (*callback)(u32 event), u32 events)
 {
        struct avc_callback_node *c;
        int rc = 0;
@@ -527,9 +511,6 @@ int __init avc_add_callback(int (*callback)(u32 event, u32 ssid, u32 tsid,
 
        c->callback = callback;
        c->events = events;
-       c->ssid = ssid;
-       c->tsid = tsid;
-       c->perms = perms;
        c->next = avc_callbacks;
        avc_callbacks = c;
 out:
@@ -669,8 +650,7 @@ int avc_ss_reset(u32 seqno)
 
        for (c = avc_callbacks; c; c = c->next) {
                if (c->events & AVC_CALLBACK_RESET) {
-                       tmprc = c->callback(AVC_CALLBACK_RESET,
-                                           0, 0, 0, 0, NULL);
+                       tmprc = c->callback(AVC_CALLBACK_RESET);
                        /* save the first error encountered for the return
                           value and continue processing the callbacks */
                        if (!rc)
index d97fadc4d963b2f6adfdc2226c4d89ab63f41dcc..92d0ab561db80cb4aa253815149a35e02d6175d1 100644 (file)
@@ -170,11 +170,7 @@ u32 avc_policy_seqno(void);
 #define AVC_CALLBACK_AUDITDENY_ENABLE  64
 #define AVC_CALLBACK_AUDITDENY_DISABLE 128
 
-int avc_add_callback(int (*callback)(u32 event, u32 ssid, u32 tsid,
-                                    u16 tclass, u32 perms,
-                                    u32 *out_retained),
-                    u32 events, u32 ssid, u32 tsid,
-                    u16 tclass, u32 perms);
+int avc_add_callback(int (*callback)(u32 event), u32 events);
 
 /* Exported to selinuxfs */
 int avc_get_hash_stats(char *page);
index 326f22cbe405d745912965a11bd7c6babb28e7b6..47a49d1a6f6adf7b60873fcfb1249b1ee023f5b9 100644 (file)
@@ -252,8 +252,7 @@ static void sel_netif_flush(void)
        spin_unlock_bh(&sel_netif_lock);
 }
 
-static int sel_netif_avc_callback(u32 event, u32 ssid, u32 tsid,
-                                 u16 class, u32 perms, u32 *retained)
+static int sel_netif_avc_callback(u32 event)
 {
        if (event == AVC_CALLBACK_RESET) {
                sel_netif_flush();
@@ -292,8 +291,7 @@ static __init int sel_netif_init(void)
 
        register_netdevice_notifier(&sel_netif_netdev_notifier);
 
-       err = avc_add_callback(sel_netif_avc_callback, AVC_CALLBACK_RESET,
-                              SECSID_NULL, SECSID_NULL, SECCLASS_NULL, 0);
+       err = avc_add_callback(sel_netif_avc_callback, AVC_CALLBACK_RESET);
        if (err)
                panic("avc_add_callback() failed, error %d\n", err);
 
index 86365857c0887b8bd4551c0dc7667c0fba9bf9e2..28f911cdd7c79dc292171fea10385adad51a27eb 100644 (file)
@@ -297,8 +297,7 @@ static void sel_netnode_flush(void)
        spin_unlock_bh(&sel_netnode_lock);
 }
 
-static int sel_netnode_avc_callback(u32 event, u32 ssid, u32 tsid,
-                                   u16 class, u32 perms, u32 *retained)
+static int sel_netnode_avc_callback(u32 event)
 {
        if (event == AVC_CALLBACK_RESET) {
                sel_netnode_flush();
@@ -320,8 +319,7 @@ static __init int sel_netnode_init(void)
                sel_netnode_hash[iter].size = 0;
        }
 
-       ret = avc_add_callback(sel_netnode_avc_callback, AVC_CALLBACK_RESET,
-                              SECSID_NULL, SECSID_NULL, SECCLASS_NULL, 0);
+       ret = avc_add_callback(sel_netnode_avc_callback, AVC_CALLBACK_RESET);
        if (ret != 0)
                panic("avc_add_callback() failed, error %d\n", ret);
 
index 7b9eb1faf68b5fe435b7f70e36ff21330934d6a2..d35379781c2c44ab188cb7aed071579da189bb53 100644 (file)
@@ -234,8 +234,7 @@ static void sel_netport_flush(void)
        spin_unlock_bh(&sel_netport_lock);
 }
 
-static int sel_netport_avc_callback(u32 event, u32 ssid, u32 tsid,
-                                   u16 class, u32 perms, u32 *retained)
+static int sel_netport_avc_callback(u32 event)
 {
        if (event == AVC_CALLBACK_RESET) {
                sel_netport_flush();
@@ -257,8 +256,7 @@ static __init int sel_netport_init(void)
                sel_netport_hash[iter].size = 0;
        }
 
-       ret = avc_add_callback(sel_netport_avc_callback, AVC_CALLBACK_RESET,
-                              SECSID_NULL, SECSID_NULL, SECCLASS_NULL, 0);
+       ret = avc_add_callback(sel_netport_avc_callback, AVC_CALLBACK_RESET);
        if (ret != 0)
                panic("avc_add_callback() failed, error %d\n", ret);
 
index 9b7e7ed54e7e7b19b45b672015693ce47a4eca0c..4321b8fc886337946bd3366410a4815dfbd6dc10 100644 (file)
@@ -3044,8 +3044,7 @@ out:
 
 static int (*aurule_callback)(void) = audit_update_lsm_rules;
 
-static int aurule_avc_callback(u32 event, u32 ssid, u32 tsid,
-                              u16 class, u32 perms, u32 *retained)
+static int aurule_avc_callback(u32 event)
 {
        int err = 0;
 
@@ -3058,8 +3057,7 @@ static int __init aurule_init(void)
 {
        int err;
 
-       err = avc_add_callback(aurule_avc_callback, AVC_CALLBACK_RESET,
-                              SECSID_NULL, SECSID_NULL, SECCLASS_NULL, 0);
+       err = avc_add_callback(aurule_avc_callback, AVC_CALLBACK_RESET);
        if (err)
                panic("avc_add_callback() failed, error %d\n", err);