Commit c6089735 authored by Eric W. Biederman's avatar Eric W. Biederman

userns: net: Call key_alloc with GLOBAL_ROOT_UID, GLOBAL_ROOT_GID instead of 0, 0

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: default avatarSerge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: default avatarEric W. Biederman <ebiederm@xmission.com>
parent 9a56c2db
...@@ -938,8 +938,6 @@ config UIDGID_CONVERTED ...@@ -938,8 +938,6 @@ config UIDGID_CONVERTED
# Networking # Networking
depends on NET_9P = n depends on NET_9P = n
depends on AF_RXRPC = n
depends on DNS_RESOLVER = n
# Filesystems # Filesystems
depends on USB_GADGETFS = n depends on USB_GADGETFS = n
......
...@@ -259,7 +259,8 @@ static int __init init_dns_resolver(void) ...@@ -259,7 +259,8 @@ static int __init init_dns_resolver(void)
if (!cred) if (!cred)
return -ENOMEM; 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_POS_ALL & ~KEY_POS_SETATTR) |
KEY_USR_VIEW | KEY_USR_READ, KEY_USR_VIEW | KEY_USR_READ,
KEY_ALLOC_NOT_IN_QUOTA); KEY_ALLOC_NOT_IN_QUOTA);
......
...@@ -948,7 +948,8 @@ int rxrpc_get_server_data_key(struct rxrpc_connection *conn, ...@@ -948,7 +948,8 @@ int rxrpc_get_server_data_key(struct rxrpc_connection *conn,
_enter(""); _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); KEY_ALLOC_NOT_IN_QUOTA);
if (IS_ERR(key)) { if (IS_ERR(key)) {
_leave(" = -ENOMEM [alloc %ld]", PTR_ERR(key)); _leave(" = -ENOMEM [alloc %ld]", PTR_ERR(key));
...@@ -994,7 +995,8 @@ struct key *rxrpc_get_null_key(const char *keyname) ...@@ -994,7 +995,8 @@ struct key *rxrpc_get_null_key(const char *keyname)
struct key *key; struct key *key;
int ret; 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); KEY_POS_SEARCH, KEY_ALLOC_NOT_IN_QUOTA);
if (IS_ERR(key)) if (IS_ERR(key))
return key; return key;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment