Merge branch 'fixes' of http://ftp.arm.linux.org.uk/pub/linux/arm/kernel/git-cur...
[pandora-kernel.git] / security / keys / user_defined.c
index c6ca866..69ff52c 100644 (file)
@@ -68,18 +68,6 @@ error:
 
 EXPORT_SYMBOL_GPL(user_instantiate);
 
-/*
- * dispose of the old data from an updated user defined key
- */
-static void user_update_rcu_disposal(struct rcu_head *rcu)
-{
-       struct user_key_payload *upayload;
-
-       upayload = container_of(rcu, struct user_key_payload, rcu);
-
-       kfree(upayload);
-}
-
 /*
  * update a user defined key
  * - the key's semaphore is write-locked
@@ -114,7 +102,8 @@ int user_update(struct key *key, const void *data, size_t datalen)
                key->expiry = 0;
        }
 
-       call_rcu(&zap->rcu, user_update_rcu_disposal);
+       if (zap)
+               kfree_rcu(zap, rcu);
 
 error:
        return ret;
@@ -145,7 +134,7 @@ void user_revoke(struct key *key)
 
        if (upayload) {
                rcu_assign_pointer(key->payload.data, NULL);
-               call_rcu(&upayload->rcu, user_update_rcu_disposal);
+               kfree_rcu(upayload, rcu);
        }
 }
 
@@ -169,8 +158,8 @@ EXPORT_SYMBOL_GPL(user_destroy);
 void user_describe(const struct key *key, struct seq_file *m)
 {
        seq_puts(m, key->description);
-
-       seq_printf(m, ": %u", key->datalen);
+       if (key_is_instantiated(key))
+               seq_printf(m, ": %u", key->datalen);
 }
 
 EXPORT_SYMBOL_GPL(user_describe);