userns: net: Call key_alloc with GLOBAL_ROOT_UID, GLOBAL_ROOT_GID instead of 0, 0
authorEric W. Biederman <ebiederm@xmission.com>
Fri, 25 May 2012 22:37:54 +0000 (16:37 -0600)
committerEric W. Biederman <ebiederm@xmission.com>
Fri, 14 Sep 2012 01:28:04 +0000 (18:28 -0700)
In net/dns_resolver/dns_key.c and net/rxrpc/ar-key.c make them
work with user namespaces enabled where key_alloc takes kuids and kgids.
Pass GLOBAL_ROOT_UID and GLOBAL_ROOT_GID instead of bare 0's.

Cc: Sage Weil <sage@inktank.com>
Cc: ceph-devel@vger.kernel.org
Cc: David Howells <dhowells@redhat.com>
Cc: David Miller <davem@davemloft.net>
Cc: linux-afs@lists.infradead.org
Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
init/Kconfig
net/dns_resolver/dns_key.c
net/rxrpc/ar-key.c

index 8dce71122709bff37ba5e74f0aad9216686c6eb1..fd8696b1a81e3299e6aa0308315369a2f7a4fd47 100644 (file)
@@ -938,8 +938,6 @@ config UIDGID_CONVERTED
 
        # Networking
        depends on NET_9P = n
-       depends on AF_RXRPC = n
-       depends on DNS_RESOLVER = n
 
        # Filesystems
        depends on USB_GADGETFS = n
index d9507dd058182295a80bacf0b966e71602307e84..9807945a56d90e0e0feb5c32f5ebaedca6de208f 100644 (file)
@@ -259,7 +259,8 @@ static int __init init_dns_resolver(void)
        if (!cred)
                return -ENOMEM;
 
-       keyring = key_alloc(&key_type_keyring, ".dns_resolver", 0, 0, cred,
+       keyring = key_alloc(&key_type_keyring, ".dns_resolver",
+                           GLOBAL_ROOT_UID, GLOBAL_ROOT_GID, cred,
                            (KEY_POS_ALL & ~KEY_POS_SETATTR) |
                            KEY_USR_VIEW | KEY_USR_READ,
                            KEY_ALLOC_NOT_IN_QUOTA);
index 8b1f9f49960f6b6d40285b80896944923737323e..011d2384b115ebdbc3bc1f8fdf79a1ef54e8bd3e 100644 (file)
@@ -948,7 +948,8 @@ int rxrpc_get_server_data_key(struct rxrpc_connection *conn,
 
        _enter("");
 
-       key = key_alloc(&key_type_rxrpc, "x", 0, 0, cred, 0,
+       key = key_alloc(&key_type_rxrpc, "x",
+                       GLOBAL_ROOT_UID, GLOBAL_ROOT_GID, cred, 0,
                        KEY_ALLOC_NOT_IN_QUOTA);
        if (IS_ERR(key)) {
                _leave(" = -ENOMEM [alloc %ld]", PTR_ERR(key));
@@ -994,7 +995,8 @@ struct key *rxrpc_get_null_key(const char *keyname)
        struct key *key;
        int ret;
 
-       key = key_alloc(&key_type_rxrpc, keyname, 0, 0, cred,
+       key = key_alloc(&key_type_rxrpc, keyname,
+                       GLOBAL_ROOT_UID, GLOBAL_ROOT_GID, cred,
                        KEY_POS_SEARCH, KEY_ALLOC_NOT_IN_QUOTA);
        if (IS_ERR(key))
                return key;