Merge branch 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvar...
[pandora-kernel.git] / security / selinux / avc.c
index 1d027e2..fcb89cb 100644 (file)
 #define AVC_CACHE_RECLAIM              16
 
 #ifdef CONFIG_SECURITY_SELINUX_AVC_STATS
-#define avc_cache_stats_incr(field)                            \
-do {                                                           \
-       per_cpu(avc_cache_stats, get_cpu()).field++;            \
-       put_cpu();                                              \
-} while (0)
+#define avc_cache_stats_incr(field)    this_cpu_inc(avc_cache_stats.field)
 #else
 #define avc_cache_stats_incr(field)    do {} while (0)
 #endif
@@ -347,11 +343,10 @@ static struct avc_node *avc_lookup(u32 ssid, u32 tsid, u16 tclass)
        node = avc_search_node(ssid, tsid, tclass);
 
        if (node)
-               avc_cache_stats_incr(hits);
-       else
-               avc_cache_stats_incr(misses);
+               return node;
 
-       return node;
+       avc_cache_stats_incr(misses);
+       return NULL;
 }
 
 static int avc_latest_notif_update(int seqno, int is_insert)
@@ -531,7 +526,7 @@ int avc_audit(u32 ssid, u32 tsid,
         * during retry. However this is logically just as if the operation
         * happened a little later.
         */
-       if ((a->type == LSM_AUDIT_DATA_FS) &&
+       if ((a->type == LSM_AUDIT_DATA_INODE) &&
            (flags & IPERM_FLAG_RCU))
                return -ECHILD;
 
@@ -769,7 +764,7 @@ int avc_has_perm_noaudit(u32 ssid, u32 tsid,
        rcu_read_lock();
 
        node = avc_lookup(ssid, tsid, tclass);
-       if (!node) {
+       if (unlikely(!node)) {
                rcu_read_unlock();
 
                if (in_avd)