security/keys: export key_lookup()
authorHannes Reinecke <hare@suse.de>
Thu, 24 Aug 2023 14:39:13 +0000 (16:39 +0200)
committerKeith Busch <kbusch@kernel.org>
Wed, 11 Oct 2023 17:11:54 +0000 (10:11 -0700)
For in-kernel consumers one cannot readily assign a user (eg when
running from a workqueue), so the normal key search permissions
cannot be applied.
This patch exports the 'key_lookup()' function for a simple lookup
of keys without checking for permissions.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Acked-by: David Howells <dhowells@redhat.com>
Signed-off-by: Keith Busch <kbusch@kernel.org>
include/linux/key.h
security/keys/key.c

index 938d7ecfb495def7b3e6c5e5a7985b1b134561e7..943a432da3ae613d09c98952ff82775d07f71b45 100644 (file)
@@ -515,6 +515,7 @@ extern void key_init(void);
 #define key_init()                     do { } while(0)
 #define key_free_user_ns(ns)           do { } while(0)
 #define key_remove_domain(d)           do { } while(0)
+#define key_lookup(k)                  NULL
 
 #endif /* CONFIG_KEYS */
 #endif /* __KERNEL__ */
index 5c0c7df833f8a90ff27ef52e889300be1ef954c0..0260a1902922eb47aa79e94437239f6687c1c86b 100644 (file)
@@ -693,6 +693,7 @@ error:
        spin_unlock(&key_serial_lock);
        return key;
 }
+EXPORT_SYMBOL(key_lookup);
 
 /*
  * Find and lock the specified key type against removal.