security/keys: export key_lookup()

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>
This commit is contained in:
Hannes Reinecke 2023-08-24 16:39:13 +02:00 committed by Keith Busch
parent 501cc6f4ac
commit 037c34318a
2 changed files with 2 additions and 0 deletions

View File

@ -515,6 +515,7 @@ extern void key_init(void);
#define key_init() do { } while(0) #define key_init() do { } while(0)
#define key_free_user_ns(ns) do { } while(0) #define key_free_user_ns(ns) do { } while(0)
#define key_remove_domain(d) do { } while(0) #define key_remove_domain(d) do { } while(0)
#define key_lookup(k) NULL
#endif /* CONFIG_KEYS */ #endif /* CONFIG_KEYS */
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */

View File

@ -693,6 +693,7 @@ error:
spin_unlock(&key_serial_lock); spin_unlock(&key_serial_lock);
return key; return key;
} }
EXPORT_SYMBOL(key_lookup);
/* /*
* Find and lock the specified key type against removal. * Find and lock the specified key type against removal.