mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 04:33:26 +02:00
Merge tag 'keys-misc-20210126' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs
Pull keyring updates from David Howells: "Here's a set of minor keyrings fixes/cleanups that I've collected from various people for the upcoming merge window. A couple of them might, in theory, be visible to userspace: - Make blacklist_vet_description() reject uppercase letters as they don't match the all-lowercase hex string generated for a blacklist search. This may want reconsideration in the future, but, currently, you can't add to the blacklist keyring from userspace and the only source of blacklist keys generates lowercase descriptions. - Fix blacklist_init() to use a new KEY_ALLOC_* flag to indicate that it wants KEY_FLAG_KEEP to be set rather than passing KEY_FLAG_KEEP into keyring_alloc() as KEY_FLAG_KEEP isn't a valid alloc flag. This isn't currently a problem as the blacklist keyring isn't currently writable by userspace. The rest of the patches are cleanups and I don't think they should have any visible effect" * tag 'keys-misc-20210126' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs: watch_queue: rectify kernel-doc for init_watch() certs: Replace K{U,G}IDT_INIT() with GLOBAL_ROOT_{U,G}ID certs: Fix blacklist flag type confusion PKCS#7: Fix missing include certs: Fix blacklisted hexadecimal hash string check certs/blacklist: fix kernel doc interface issue crypto: public_key: Remove redundant header file from public_key.h keys: remove trailing semicolon in macro definition crypto: pkcs7: Use match_string() helper to simplify the code PKCS#7: drop function from kernel-doc pkcs7_validate_trust_one encrypted-keys: Replace HTTP links with HTTPS ones crypto: asymmetric_keys: fix some comments in pkcs7_parser.h KEYS: remove redundant memset security: keys: delete repeated words in comments KEYS: asymmetric: Fix kerneldoc security/keys: use kvfree_sensitive() watch_queue: Drop references to /dev/watch_queue keys: Remove outdated __user annotations security: keys: Fix fall-through warnings for Clang
This commit is contained in:
@@ -38,13 +38,12 @@ __init int ima_mok_init(void)
|
||||
(KEY_POS_ALL & ~KEY_POS_SETATTR) |
|
||||
KEY_USR_VIEW | KEY_USR_READ |
|
||||
KEY_USR_WRITE | KEY_USR_SEARCH,
|
||||
KEY_ALLOC_NOT_IN_QUOTA,
|
||||
KEY_ALLOC_NOT_IN_QUOTA |
|
||||
KEY_ALLOC_SET_KEEP,
|
||||
restriction, NULL);
|
||||
|
||||
if (IS_ERR(ima_blacklist_keyring))
|
||||
panic("Can't allocate IMA blacklist keyring.");
|
||||
|
||||
set_bit(KEY_FLAG_KEEP, &ima_blacklist_keyring->flags);
|
||||
return 0;
|
||||
}
|
||||
device_initcall(ima_mok_init);
|
||||
|
@@ -119,7 +119,7 @@ config KEY_NOTIFICATIONS
|
||||
bool "Provide key/keyring change notifications"
|
||||
depends on KEYS && WATCH_QUEUE
|
||||
help
|
||||
This option provides support for getting change notifications on keys
|
||||
and keyrings on which the caller has View permission. This makes use
|
||||
of the /dev/watch_queue misc device to handle the notification
|
||||
buffer and provides KEYCTL_WATCH_KEY to enable/disable watches.
|
||||
This option provides support for getting change notifications
|
||||
on keys and keyrings on which the caller has View permission.
|
||||
This makes use of pipes to handle the notification buffer and
|
||||
provides KEYCTL_WATCH_KEY to enable/disable watches.
|
||||
|
@@ -121,8 +121,7 @@ int big_key_preparse(struct key_preparsed_payload *prep)
|
||||
*path = file->f_path;
|
||||
path_get(path);
|
||||
fput(file);
|
||||
memzero_explicit(buf, enclen);
|
||||
kvfree(buf);
|
||||
kvfree_sensitive(buf, enclen);
|
||||
} else {
|
||||
/* Just store the data in a buffer */
|
||||
void *data = kmalloc(datalen, GFP_KERNEL);
|
||||
@@ -140,8 +139,7 @@ err_fput:
|
||||
err_enckey:
|
||||
kfree_sensitive(enckey);
|
||||
error:
|
||||
memzero_explicit(buf, enclen);
|
||||
kvfree(buf);
|
||||
kvfree_sensitive(buf, enclen);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -273,8 +271,7 @@ long big_key_read(const struct key *key, char *buffer, size_t buflen)
|
||||
err_fput:
|
||||
fput(file);
|
||||
error:
|
||||
memzero_explicit(buf, enclen);
|
||||
kvfree(buf);
|
||||
kvfree_sensitive(buf, enclen);
|
||||
} else {
|
||||
ret = datalen;
|
||||
memcpy(buffer, key->payload.data[big_key_data], datalen);
|
||||
|
@@ -303,6 +303,8 @@ struct key *key_alloc(struct key_type *type, const char *desc,
|
||||
key->flags |= 1 << KEY_FLAG_BUILTIN;
|
||||
if (flags & KEY_ALLOC_UID_KEYRING)
|
||||
key->flags |= 1 << KEY_FLAG_UID_KEYRING;
|
||||
if (flags & KEY_ALLOC_SET_KEEP)
|
||||
key->flags |= 1 << KEY_FLAG_KEEP;
|
||||
|
||||
#ifdef KEY_DEBUGGING
|
||||
key->magic = KEY_DEBUG_MAGIC;
|
||||
|
@@ -506,7 +506,7 @@ error:
|
||||
* keyring, otherwise replace the link to the matching key with a link to the
|
||||
* new key.
|
||||
*
|
||||
* The key must grant the caller Link permission and the the keyring must grant
|
||||
* The key must grant the caller Link permission and the keyring must grant
|
||||
* the caller Write permission. Furthermore, if an additional link is created,
|
||||
* the keyring's quota will be extended.
|
||||
*
|
||||
|
@@ -166,8 +166,6 @@ long keyctl_pkey_query(key_serial_t id,
|
||||
struct kernel_pkey_query res;
|
||||
long ret;
|
||||
|
||||
memset(¶ms, 0, sizeof(params));
|
||||
|
||||
ret = keyctl_pkey_params_get(id, _info, ¶ms);
|
||||
if (ret < 0)
|
||||
goto error;
|
||||
|
@@ -452,7 +452,7 @@ static void keyring_describe(const struct key *keyring, struct seq_file *m)
|
||||
struct keyring_read_iterator_context {
|
||||
size_t buflen;
|
||||
size_t count;
|
||||
key_serial_t __user *buffer;
|
||||
key_serial_t *buffer;
|
||||
};
|
||||
|
||||
static int keyring_read_iterator(const void *object, void *data)
|
||||
@@ -479,7 +479,7 @@ static int keyring_read_iterator(const void *object, void *data)
|
||||
* times.
|
||||
*/
|
||||
static long keyring_read(const struct key *keyring,
|
||||
char __user *buffer, size_t buflen)
|
||||
char *buffer, size_t buflen)
|
||||
{
|
||||
struct keyring_read_iterator_context ctx;
|
||||
long ret;
|
||||
@@ -491,7 +491,7 @@ static long keyring_read(const struct key *keyring,
|
||||
|
||||
/* Copy as many key IDs as fit into the buffer */
|
||||
if (buffer && buflen) {
|
||||
ctx.buffer = (key_serial_t __user *)buffer;
|
||||
ctx.buffer = (key_serial_t *)buffer;
|
||||
ctx.buflen = buflen;
|
||||
ctx.count = 0;
|
||||
ret = assoc_array_iterate(&keyring->keys,
|
||||
@@ -881,7 +881,7 @@ found:
|
||||
*
|
||||
* Keys are matched to the type provided and are then filtered by the match
|
||||
* function, which is given the description to use in any way it sees fit. The
|
||||
* match function may use any attributes of a key that it wishes to to
|
||||
* match function may use any attributes of a key that it wishes to
|
||||
* determine the match. Normally the match function from the key type would be
|
||||
* used.
|
||||
*
|
||||
@@ -1204,7 +1204,7 @@ static int keyring_detect_cycle_iterator(const void *object,
|
||||
}
|
||||
|
||||
/*
|
||||
* See if a cycle will will be created by inserting acyclic tree B in acyclic
|
||||
* See if a cycle will be created by inserting acyclic tree B in acyclic
|
||||
* tree A at the topmost level (ie: as a direct child of A).
|
||||
*
|
||||
* Since we are adding B to A at the top level, checking for cycles should just
|
||||
|
@@ -783,6 +783,7 @@ try_again:
|
||||
if (need_perm != KEY_AUTHTOKEN_OVERRIDE &&
|
||||
need_perm != KEY_DEFER_PERM_CHECK)
|
||||
goto invalid_key;
|
||||
break;
|
||||
case 0:
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user