linux-next: manual merge of the keys tree with the afs tree

From: Stephen Rothwell
Date: Tue Jul 23 2019 - 22:29:34 EST


Hi all,

Today's linux-next merge of the keys tree got conflicts in:

fs/afs/security.c
include/linux/key.h

between commit:

dd05d852085f ("afs: Provide an RCU-capable key lookup")

from the afs tree and commit:

f802f2b3a991 ("keys: Replace uid/gid/perm permissions checking with an ACL")

from the keys tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging. You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

--
Cheers,
Stephen Rothwell

diff --cc fs/afs/security.c
index ce9de1e6742b,8866703b2e6c..000000000000
--- a/fs/afs/security.c
+++ b/fs/afs/security.c
@@@ -27,37 -27,8 +27,37 @@@ struct key *afs_request_key(struct afs_
_enter("{%x}", key_serial(cell->anonymous_key));

_debug("key %s", cell->anonymous_key->description);
- key = request_key(&key_type_rxrpc, cell->anonymous_key->description,
- NULL, NULL);
+ key = request_key_net(&key_type_rxrpc, cell->anonymous_key->description,
- cell->net->net, NULL);
++ cell->net->net, NULL, NULL);
+ if (IS_ERR(key)) {
+ if (PTR_ERR(key) != -ENOKEY) {
+ _leave(" = %ld", PTR_ERR(key));
+ return key;
+ }
+
+ /* act as anonymous user */
+ _leave(" = {%x} [anon]", key_serial(cell->anonymous_key));
+ return key_get(cell->anonymous_key);
+ } else {
+ /* act as authorised user */
+ _leave(" = {%x} [auth]", key_serial(key));
+ return key;
+ }
+}
+
+/*
+ * Get a key when pathwalk is in rcuwalk mode.
+ */
+struct key *afs_request_key_rcu(struct afs_cell *cell)
+{
+ struct key *key;
+
+ _enter("{%x}", key_serial(cell->anonymous_key));
+
+ _debug("key %s", cell->anonymous_key->description);
+ key = request_key_net_rcu(&key_type_rxrpc,
+ cell->anonymous_key->description,
+ cell->net->net);
if (IS_ERR(key)) {
if (PTR_ERR(key) != -ENOKEY) {
_leave(" = %ld", PTR_ERR(key));
diff --cc include/linux/key.h
index bec10fbb2462,6fef6684501f..000000000000
--- a/include/linux/key.h
+++ b/include/linux/key.h
@@@ -339,20 -340,8 +340,20 @@@ static inline struct key *request_key(s
* Furthermore, it then works as wait_for_key_construction() to wait for the
* completion of keys undergoing construction with a non-interruptible wait.
*/
- #define request_key_net(type, description, net, callout_info) \
- request_key_tag(type, description, net->key_domain, callout_info);
+ #define request_key_net(type, description, net, callout_info, acl) \
+ request_key_tag(type, description, net->key_domain, callout_info, acl);
+
+/**
+ * request_key_net_rcu - Request a key for a net namespace under RCU conditions
+ * @type: Type of key.
+ * @description: The searchable description of the key.
+ * @net: The network namespace that is the key's domain of operation.
+ *
+ * As for request_key_rcu() except that only keys that operate the specified
+ * network namespace are used.
+ */
+#define request_key_net_rcu(type, description, net) \
+ request_key_rcu(type, description, net->key_domain);
#endif /* CONFIG_NET */

extern int wait_for_key_construction(struct key *key, bool intr);

Attachment: pgptsvLjbxmHm.pgp
Description: OpenPGP digital signature