Skip to content

Commit

Permalink
KEYS: Fix up comments in key management code
Browse files Browse the repository at this point in the history
Fix up comments in the key management code.  No functional changes.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
David Howells authored and Linus Torvalds committed Jan 21, 2011
1 parent a8b17ed commit 973c9f4
Show file tree
Hide file tree
Showing 11 changed files with 777 additions and 366 deletions.
13 changes: 7 additions & 6 deletions security/keys/compat.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* compat.c: 32-bit compatibility syscall for 64-bit systems
/* 32-bit compatibility syscall for 64-bit systems
*
* Copyright (C) 2004-5 Red Hat, Inc. All Rights Reserved.
* Written by David Howells (dhowells@redhat.com)
Expand All @@ -15,11 +15,12 @@
#include "internal.h"

/*
* the key control system call, 32-bit compatibility version for 64-bit archs
* - this should only be called if the 64-bit arch uses weird pointers in
* 32-bit mode or doesn't guarantee that the top 32-bits of the argument
* registers on taking a 32-bit syscall are zero
* - if you can, you should call sys_keyctl directly
* The key control system call, 32-bit compatibility version for 64-bit archs
*
* This should only be called if the 64-bit arch uses weird pointers in 32-bit
* mode or doesn't guarantee that the top 32-bits of the argument registers on
* taking a 32-bit syscall are zero. If you can, you should call sys_keyctl()
* directly.
*/
asmlinkage long compat_sys_keyctl(u32 option,
u32 arg2, u32 arg3, u32 arg4, u32 arg5)
Expand Down
14 changes: 7 additions & 7 deletions security/keys/gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ static time_t key_gc_next_run = LONG_MAX;
static time_t key_gc_new_timer;

/*
* Schedule a garbage collection run
* - precision isn't particularly important
* Schedule a garbage collection run.
* - time precision isn't particularly important
*/
void key_schedule_gc(time_t gc_at)
{
Expand Down Expand Up @@ -61,8 +61,9 @@ static void key_gc_timer_func(unsigned long data)
}

/*
* Garbage collect pointers from a keyring
* - return true if we altered the keyring
* Garbage collect pointers from a keyring.
*
* Return true if we altered the keyring.
*/
static bool key_gc_keyring(struct key *keyring, time_t limit)
__releases(key_serial_lock)
Expand Down Expand Up @@ -107,9 +108,8 @@ static bool key_gc_keyring(struct key *keyring, time_t limit)
}

/*
* Garbage collector for keys
* - this involves scanning the keyrings for dead, expired and revoked keys
* that have overstayed their welcome
* Garbage collector for keys. This involves scanning the keyrings for dead,
* expired and revoked keys that have overstayed their welcome
*/
static void key_garbage_collector(struct work_struct *work)
{
Expand Down
26 changes: 14 additions & 12 deletions security/keys/internal.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* internal.h: authentication token and access key management internal defs
/* Authentication token and access key management internal defs
*
* Copyright (C) 2003-5, 2007 Red Hat, Inc. All Rights Reserved.
* Written by David Howells (dhowells@redhat.com)
Expand Down Expand Up @@ -35,10 +35,12 @@ extern struct key_type key_type_user;

/*****************************************************************************/
/*
* keep track of keys for a user
* - this needs to be separate to user_struct to avoid a refcount-loop
* (user_struct pins some keyrings which pin this struct)
* - this also keeps track of keys under request from userspace for this UID
* Keep track of keys for a user.
*
* This needs to be separate to user_struct to avoid a refcount-loop
* (user_struct pins some keyrings which pin this struct).
*
* We also keep track of keys under request from userspace for this UID here.
*/
struct key_user {
struct rb_node node;
Expand All @@ -62,7 +64,7 @@ extern struct key_user *key_user_lookup(uid_t uid,
extern void key_user_put(struct key_user *user);

/*
* key quota limits
* Key quota limits.
* - root has its own separate limits to everyone else
*/
extern unsigned key_quota_root_maxkeys;
Expand Down Expand Up @@ -146,13 +148,13 @@ extern unsigned key_gc_delay;
extern void keyring_gc(struct key *keyring, time_t limit);
extern void key_schedule_gc(time_t expiry_at);

/*
* check to see whether permission is granted to use a key in the desired way
*/
extern int key_task_permission(const key_ref_t key_ref,
const struct cred *cred,
key_perm_t perm);

/*
* Check to see whether permission is granted to use a key in the desired way.
*/
static inline int key_permission(const key_ref_t key_ref, key_perm_t perm)
{
return key_task_permission(key_ref, current_cred(), perm);
Expand All @@ -168,7 +170,7 @@ static inline int key_permission(const key_ref_t key_ref, key_perm_t perm)
#define KEY_ALL 0x3f /* all the above permissions */

/*
* request_key authorisation
* Authorisation record for request_key().
*/
struct request_key_auth {
struct key *target_key;
Expand All @@ -188,7 +190,7 @@ extern struct key *request_key_auth_new(struct key *target,
extern struct key *key_get_instantiation_authkey(key_serial_t target_id);

/*
* keyctl functions
* keyctl() functions
*/
extern long keyctl_get_keyring_ID(key_serial_t, int);
extern long keyctl_join_session_keyring(const char __user *);
Expand All @@ -214,7 +216,7 @@ extern long keyctl_get_security(key_serial_t keyid, char __user *buffer,
extern long keyctl_session_to_parent(void);

/*
* debugging key validation
* Debugging key validation
*/
#ifdef KEY_DEBUGGING
extern void __key_check(const struct key *);
Expand Down
Loading

0 comments on commit 973c9f4

Please sign in to comment.