LINUX 5.3.0: Check for 'recurse' arg in keyring_search 52/13752/3
authorCheyenne Wills <cwills@sinenomine.net>
Thu, 8 Aug 2019 22:53:13 +0000 (16:53 -0600)
committerBenjamin Kaduk <kaduk@mit.edu>
Fri, 16 Aug 2019 15:14:13 +0000 (11:14 -0400)
Linux 5.3.0 commit dcf49dbc8077e278ddd1bc7298abc781496e8a08 "keys: Add a
'recurse' flag for keyring searches" adds a new parameter to
Linux kernel keyring_search function.

Update the call to keyring_search to include the recurse parameter if
available. Setting the parameter to true (1) maintains the current
search behavior.

Change-Id: I54b7ed686bf1fb4c42789e5d251ae76789e9fc88
Reviewed-on: https://gerrit.openafs.org/13752
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>

src/afs/LINUX/osi_compat.h
src/cf/linux-kernel-assorted.m4
src/cf/linux-test4.m4

index abe6b71..d236081 100644 (file)
@@ -222,9 +222,15 @@ afs_linux_search_keyring(afs_ucred_t *cred, struct key_type *type)
     key_ref_t key_ref;
 
     if (afs_session_keyring(cred)) {
+#  if defined(KEYRING_SEARCH_TAKES_RECURSE)
+       key_ref = keyring_search(
+                     make_key_ref(afs_session_keyring(cred), 1),
+                     type, "_pag", 1);
+#  else
        key_ref = keyring_search(
                      make_key_ref(afs_session_keyring(cred), 1),
                      type, "_pag");
+#  endif
        if (IS_ERR(key_ref))
            return ERR_CAST(key_ref);
 
index 191b603..6fa6051 100644 (file)
@@ -55,6 +55,7 @@ LINUX_DOP_D_REVALIDATE_TAKES_UNSIGNED
 LINUX_IOP_LOOKUP_TAKES_UNSIGNED
 LINUX_D_INVALIDATE_IS_VOID
 LINUX_KERNEL_READ_OFFSET_IS_LAST
+LINUX_KEYRING_SEARCH_TAKES_RECURSE
 ])
 
 
index cf82056..f7699ce 100644 (file)
@@ -836,3 +836,16 @@ AC_DEFUN([LINUX_KERNEL_READ_OFFSET_IS_LAST], [
                        [define if your kernel_read has offset as the last argument],
                        [])
 ])
+
+AC_DEFUN([LINUX_KEYRING_SEARCH_TAKES_RECURSE], [
+  AC_CHECK_LINUX_BUILD([whether keyring_search has the recurse parameter],
+                       [ac_cv_linux_func_keyring_search_takes_recurse],
+                       [#include <linux/key.h>
+                       key_ref_t tkey;],
+                       [
+                       keyring_search(tkey, NULL, NULL, 0);
+                       ],
+                       [KEYRING_SEARCH_TAKES_RECURSE],
+                       [define if your keyring_search has the recurse parameter],
+                       [])
+])