Merge branch 'work.dcache' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
[sfrench/cifs-2.6.git] / kernel / auditfilter.c
index f9fff93c335156e0920baf702a489b07e9523905..303fb04770ce3f1600c54427556ced9ceac13938 100644 (file)
@@ -1114,22 +1114,24 @@ int audit_rule_change(int type, int seq, void *data, size_t datasz)
        int err = 0;
        struct audit_entry *entry;
 
-       entry = audit_data_to_entry(data, datasz);
-       if (IS_ERR(entry))
-               return PTR_ERR(entry);
-
        switch (type) {
        case AUDIT_ADD_RULE:
+               entry = audit_data_to_entry(data, datasz);
+               if (IS_ERR(entry))
+                       return PTR_ERR(entry);
                err = audit_add_rule(entry);
                audit_log_rule_change("add_rule", &entry->rule, !err);
                break;
        case AUDIT_DEL_RULE:
+               entry = audit_data_to_entry(data, datasz);
+               if (IS_ERR(entry))
+                       return PTR_ERR(entry);
                err = audit_del_rule(entry);
                audit_log_rule_change("remove_rule", &entry->rule, !err);
                break;
        default:
-               err = -EINVAL;
                WARN_ON(1);
+               return -EINVAL;
        }
 
        if (err || type == AUDIT_DEL_RULE) {
@@ -1315,8 +1317,6 @@ int audit_filter(int msgtype, unsigned int listtype)
        int ret = 1; /* Audit by default */
 
        rcu_read_lock();
-       if (list_empty(&audit_filter_list[listtype]))
-               goto unlock_and_return;
        list_for_each_entry_rcu(e, &audit_filter_list[listtype], list) {
                int i, result = 0;