~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to security/keys/user_defined.c

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
69
69
EXPORT_SYMBOL_GPL(user_instantiate);
70
70
 
71
71
/*
72
 
 * dispose of the old data from an updated user defined key
73
 
 */
74
 
static void user_update_rcu_disposal(struct rcu_head *rcu)
75
 
{
76
 
        struct user_key_payload *upayload;
77
 
 
78
 
        upayload = container_of(rcu, struct user_key_payload, rcu);
79
 
 
80
 
        kfree(upayload);
81
 
}
82
 
 
83
 
/*
84
72
 * update a user defined key
85
73
 * - the key's semaphore is write-locked
86
74
 */
114
102
                key->expiry = 0;
115
103
        }
116
104
 
117
 
        call_rcu(&zap->rcu, user_update_rcu_disposal);
 
105
        kfree_rcu(zap, rcu);
118
106
 
119
107
error:
120
108
        return ret;
145
133
 
146
134
        if (upayload) {
147
135
                rcu_assign_pointer(key->payload.data, NULL);
148
 
                call_rcu(&upayload->rcu, user_update_rcu_disposal);
 
136
                kfree_rcu(upayload, rcu);
149
137
        }
150
138
}
151
139
 
169
157
void user_describe(const struct key *key, struct seq_file *m)
170
158
{
171
159
        seq_puts(m, key->description);
172
 
 
173
 
        seq_printf(m, ": %u", key->datalen);
 
160
        if (key_is_instantiated(key))
 
161
                seq_printf(m, ": %u", key->datalen);
174
162
}
175
163
 
176
164
EXPORT_SYMBOL_GPL(user_describe);
184
172
        struct user_key_payload *upayload;
185
173
        long ret;
186
174
 
187
 
        upayload = rcu_dereference_protected(
188
 
                key->payload.data, rwsem_is_locked(&((struct key *)key)->sem));
 
175
        upayload = rcu_dereference_key(key);
189
176
        ret = upayload->datalen;
190
177
 
191
178
        /* we can return the data as is */