Skip to content

Commit 1ed9e11

Browse files
security/keys: export key_lookup()
JIRA: https://issues.redhat.com/browse/RHEL-25547 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> (cherry picked from commit 037c343) Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
1 parent bc16d8f commit 1ed9e11

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

include/linux/key.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,7 @@ extern void key_init(void);
510510
#define key_init() do { } while(0)
511511
#define key_free_user_ns(ns) do { } while(0)
512512
#define key_remove_domain(d) do { } while(0)
513+
#define key_lookup(k) NULL
513514

514515
#endif /* CONFIG_KEYS */
515516
#endif /* __KERNEL__ */

security/keys/key.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -690,6 +690,7 @@ struct key *key_lookup(key_serial_t id)
690690
spin_unlock(&key_serial_lock);
691691
return key;
692692
}
693+
EXPORT_SYMBOL(key_lookup);
693694

694695
/*
695696
* Find and lock the specified key type against removal.

0 commit comments

Comments
 (0)