From: David Howells <dhowells@redhat.com>

The attached patch causes the per-user keyring to be linked into the user's
default session keyring rather than the other way around.

Signed-Off-By: David Howells <dhowells@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/security/keys/process_keys.c |   24 ++++++++++++------------
 1 files changed, 12 insertions(+), 12 deletions(-)

diff -puN security/keys/process_keys.c~link-user-keyrings-together-correctly security/keys/process_keys.c
--- 25/security/keys/process_keys.c~link-user-keyrings-together-correctly	Thu Sep 23 14:34:54 2004
+++ 25-akpm/security/keys/process_keys.c	Thu Sep 23 14:34:54 2004
@@ -74,24 +74,24 @@ int alloc_uid_keyring(struct user_struct
 	char buf[20];
 	int ret;
 
-	/* concoct a UID specific keyring */
-	sprintf(buf, "_uid.%u", user->uid);
+	/* concoct a default session keyring */
+	sprintf(buf, "_uid_ses.%u", user->uid);
 
-	uid_keyring = keyring_alloc(buf, user->uid, (gid_t) -1, 0, NULL);
-	if (IS_ERR(uid_keyring)) {
-		ret = PTR_ERR(uid_keyring);
+	session_keyring = keyring_alloc(buf, user->uid, (gid_t) -1, 0, NULL);
+	if (IS_ERR(session_keyring)) {
+		ret = PTR_ERR(session_keyring);
 		goto error;
 	}
 
-	/* and a default session keyring with a pointer to the UID specific
+	/* and a UID specific keyring, pointed to by the default session
 	 * keyring */
-	sprintf(buf, "_uid_ses.%u", user->uid);
+	sprintf(buf, "_uid.%u", user->uid);
 
-	session_keyring = keyring_alloc(buf, user->uid, (gid_t) -1, 0,
-					uid_keyring);
-	if (IS_ERR(session_keyring)) {
-		key_put(uid_keyring);
-		ret = PTR_ERR(session_keyring);
+	uid_keyring = keyring_alloc(buf, user->uid, (gid_t) -1, 0,
+				    session_keyring);
+	if (IS_ERR(uid_keyring)) {
+		key_put(session_keyring);
+		ret = PTR_ERR(uid_keyring);
 		goto error;
 	}
 
_