Skip to content

Commit c608973

Browse files
committed
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: Serge Hallyn <serge.hallyn@canonical.com> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
1 parent 9a56c2d commit c608973

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

init/Kconfig

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -938,8 +938,6 @@ config UIDGID_CONVERTED
938938

939939
# Networking
940940
depends on NET_9P = n
941-
depends on AF_RXRPC = n
942-
depends on DNS_RESOLVER = n
943941

944942
# Filesystems
945943
depends on USB_GADGETFS = n

net/dns_resolver/dns_key.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,8 @@ static int __init init_dns_resolver(void)
259259
if (!cred)
260260
return -ENOMEM;
261261

262-
keyring = key_alloc(&key_type_keyring, ".dns_resolver", 0, 0, cred,
262+
keyring = key_alloc(&key_type_keyring, ".dns_resolver",
263+
GLOBAL_ROOT_UID, GLOBAL_ROOT_GID, cred,
263264
(KEY_POS_ALL & ~KEY_POS_SETATTR) |
264265
KEY_USR_VIEW | KEY_USR_READ,
265266
KEY_ALLOC_NOT_IN_QUOTA);

net/rxrpc/ar-key.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -948,7 +948,8 @@ int rxrpc_get_server_data_key(struct rxrpc_connection *conn,
948948

949949
_enter("");
950950

951-
key = key_alloc(&key_type_rxrpc, "x", 0, 0, cred, 0,
951+
key = key_alloc(&key_type_rxrpc, "x",
952+
GLOBAL_ROOT_UID, GLOBAL_ROOT_GID, cred, 0,
952953
KEY_ALLOC_NOT_IN_QUOTA);
953954
if (IS_ERR(key)) {
954955
_leave(" = -ENOMEM [alloc %ld]", PTR_ERR(key));
@@ -994,7 +995,8 @@ struct key *rxrpc_get_null_key(const char *keyname)
994995
struct key *key;
995996
int ret;
996997

997-
key = key_alloc(&key_type_rxrpc, keyname, 0, 0, cred,
998+
key = key_alloc(&key_type_rxrpc, keyname,
999+
GLOBAL_ROOT_UID, GLOBAL_ROOT_GID, cred,
9981000
KEY_POS_SEARCH, KEY_ALLOC_NOT_IN_QUOTA);
9991001
if (IS_ERR(key))
10001002
return key;

0 commit comments

Comments
 (0)