Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 235095
b: refs/heads/master
c: 633e804
h: refs/heads/master
i:
  235093: b264926
  235091: 31f9845
  235087: 44d1d82
v: v3
  • Loading branch information
David Howells authored and James Morris committed Mar 8, 2011
1 parent adbbbaa commit bd076a8
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1cc26bada9f6807814806db2f0d78792eecdac71
refs/heads/master: 633e804e89464d3875e59de1959a53f9041d3094
4 changes: 4 additions & 0 deletions trunk/include/linux/key.h
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,10 @@ static inline key_serial_t key_serial(struct key *key)
return key ? key->serial : 0;
}

#define rcu_dereference_key(KEY) \
(rcu_dereference_protected((KEY)->payload.rcudata, \
rwsem_is_locked(&((struct key *)(KEY))->sem)))

#ifdef CONFIG_SYSCTL
extern ctl_table key_sysctls[];
#endif
Expand Down
3 changes: 1 addition & 2 deletions trunk/security/keys/encrypted.c
Original file line number Diff line number Diff line change
Expand Up @@ -765,8 +765,7 @@ static long encrypted_read(const struct key *key, char __user *buffer,
size_t asciiblob_len;
int ret;

epayload = rcu_dereference_protected(key->payload.data,
rwsem_is_locked(&((struct key *)key)->sem));
epayload = rcu_dereference_key(key);

/* returns the hex encoded iv, encrypted-data, and hmac as ascii */
asciiblob_len = epayload->datablob_len + ivsize + 1
Expand Down
3 changes: 1 addition & 2 deletions trunk/security/keys/trusted.c
Original file line number Diff line number Diff line change
Expand Up @@ -1076,8 +1076,7 @@ static long trusted_read(const struct key *key, char __user *buffer,
char *bufp;
int i;

p = rcu_dereference_protected(key->payload.data,
rwsem_is_locked(&((struct key *)key)->sem));
p = rcu_dereference_key(key);
if (!p)
return -EINVAL;
if (!buffer || buflen <= 0)
Expand Down
3 changes: 1 addition & 2 deletions trunk/security/keys/user_defined.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,7 @@ long user_read(const struct key *key, char __user *buffer, size_t buflen)
struct user_key_payload *upayload;
long ret;

upayload = rcu_dereference_protected(
key->payload.data, rwsem_is_locked(&((struct key *)key)->sem));
upayload = rcu_dereference_key(key);
ret = upayload->datalen;

/* we can return the data as is */
Expand Down

0 comments on commit bd076a8

Please sign in to comment.