Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Hannes Reinecke and committed by
Keith Busch
037c3431 501cc6f4

+2
+1
include/linux/key.h
··· 515 515 #define key_init() do { } while(0) 516 516 #define key_free_user_ns(ns) do { } while(0) 517 517 #define key_remove_domain(d) do { } while(0) 518 + #define key_lookup(k) NULL 518 519 519 520 #endif /* CONFIG_KEYS */ 520 521 #endif /* __KERNEL__ */
+1
security/keys/key.c
··· 693 693 spin_unlock(&key_serial_lock); 694 694 return key; 695 695 } 696 + EXPORT_SYMBOL(key_lookup); 696 697 697 698 /* 698 699 * Find and lock the specified key type against removal.