Eric Biggers
4b34968e77
X.509: fix NULL dereference when restricting key with unsupported_sig
...
The asymmetric key type allows an X.509 certificate to be added even if
its signature's hash algorithm is not available in the crypto API. In
that case 'payload.data[asym_auth]' will be NULL. But the key
restriction code failed to check for this case before trying to use the
signature, resulting in a NULL pointer dereference in
key_or_keyring_common() or in restrict_link_by_signature().
Fix this by returning -ENOPKG when the signature is unsupported.
Reproducer when all the CONFIG_CRYPTO_SHA512* options are disabled and
keyctl has support for the 'restrict_keyring' command:
keyctl new_session
keyctl restrict_keyring @s asymmetric builtin_trusted
openssl req -new -sha512 -x509 -batch -nodes -outform der \
| keyctl padd asymmetric desc @s
Fixes: a511e1af8b12 ("KEYS: Move the point of trust determination to __key_link()")
Cc: <stable@vger.kernel.org> # v4.7+
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: David Howells <dhowells@redhat.com>
2018-02-22 14:38:34 +00:00
..
2018-02-22 14:38:34 +00:00
2017-11-02 11:10:55 +01:00
2015-06-25 23:29:24 +08:00
2016-10-25 11:08:33 +08:00
2017-11-29 17:33:29 +11:00
2017-01-13 00:24:39 +08:00
2017-04-21 20:30:50 +08:00
2018-01-12 23:03:39 +11:00
2017-02-11 17:50:43 +08:00
2017-06-19 14:11:53 +08:00
2018-02-11 14:34:03 -08:00
2018-01-12 23:03:37 +11:00
2017-01-13 00:24:39 +08:00
2018-01-31 14:22:45 -08:00
2017-10-07 12:10:34 +08:00
2018-01-12 23:03:39 +11:00
2018-01-12 23:03:37 +11:00
2015-04-22 09:30:21 +08:00
2018-01-31 14:22:45 -08:00
2015-04-22 09:30:18 +08:00
2014-11-24 22:43:57 +08:00
2018-01-05 18:43:09 +11:00
2014-11-24 22:43:57 +08:00
2017-12-22 19:29:08 +11:00
2017-12-22 19:29:08 +11:00
2017-11-29 17:33:29 +11:00
2011-09-22 21:25:25 +10:00
2015-01-13 22:29:11 +11:00
2017-11-29 17:33:25 +11:00
2017-11-29 17:33:25 +11:00
2017-11-29 17:33:25 +11:00
2013-08-14 20:42:03 +10:00
2017-03-09 18:34:39 +08:00
2017-11-03 21:35:35 +08:00
2017-11-29 17:33:33 +11:00
2017-12-22 19:02:33 +11:00
2016-10-21 11:03:42 +08:00
2017-02-11 17:52:28 +08:00
2016-10-21 11:03:42 +08:00
2018-01-12 23:03:35 +11:00
2018-01-12 23:03:35 +11:00
2013-09-12 15:31:34 +10:00
2016-09-13 20:27:26 +08:00
2018-01-12 23:03:35 +11:00
2017-06-19 14:19:54 +08:00
2016-07-18 17:35:44 +08:00
2018-01-05 18:43:09 +11:00
2014-03-21 21:54:28 +08:00
2017-08-04 09:27:15 +08:00
2017-11-03 22:11:17 +08:00
2017-04-24 18:11:08 +08:00
2015-01-13 22:29:11 +11:00
2017-11-10 19:20:17 +08:00
2017-11-10 19:20:22 +08:00
2017-11-03 22:11:19 +08:00
2014-11-26 20:06:30 +08:00
2017-11-02 11:10:55 +01:00
2017-11-29 17:33:24 +11:00
2017-06-10 12:04:35 +08:00
2017-10-12 22:55:00 +08:00
2017-11-06 14:45:04 +08:00
2017-12-22 19:52:45 +11:00
2014-11-24 22:43:57 +08:00
2015-04-23 14:18:09 +08:00
2017-12-22 19:29:08 +11:00
2017-12-22 19:52:40 +11:00
2018-01-12 23:03:38 +11:00
2015-12-20 15:27:12 +02:00
2017-11-29 13:39:15 +11:00
2018-01-05 18:43:10 +11:00
2016-11-17 23:34:52 +08:00
2015-06-25 23:18:33 +08:00
2018-01-31 14:22:45 -08:00
2017-11-29 17:33:26 +11:00
2014-11-24 22:43:57 +08:00
2017-01-13 00:24:39 +08:00
2017-11-03 22:11:17 +08:00
2017-04-10 19:17:27 +08:00
2017-04-10 19:17:27 +08:00
2017-05-08 17:15:13 -07:00
2018-01-20 11:43:36 +11:00
2018-01-12 23:03:35 +11:00
2014-11-24 22:43:57 +08:00
2017-03-24 22:02:56 +08:00
2013-12-09 20:09:12 +08:00
2014-11-24 22:43:57 +08:00
2017-08-04 09:27:15 +08:00
2017-12-22 19:02:47 +11:00
2018-01-12 23:03:14 +11:00
2018-01-05 18:43:09 +11:00
2017-11-02 11:10:55 +01:00
2017-09-22 17:43:28 +08:00
2017-09-22 17:43:28 +08:00
2017-09-22 17:43:28 +08:00
2017-09-22 17:43:28 +08:00
2017-07-28 17:56:00 +08:00
2017-11-29 13:39:14 +11:00
2017-11-03 22:11:17 +08:00
2017-06-10 12:04:30 +08:00
2016-07-05 23:05:26 +08:00
2015-10-14 22:23:16 +08:00
2018-01-12 23:03:42 +11:00
2016-11-22 15:02:25 +08:00
2018-01-06 09:18:00 -07:00
2014-11-24 22:43:57 +08:00
2017-12-22 19:52:45 +11:00
2017-08-09 20:17:54 +08:00
2015-12-22 20:43:35 +08:00
2018-02-08 22:38:12 +11:00
2015-12-22 20:43:35 +08:00
2015-04-10 21:39:41 +08:00
2018-01-12 23:03:37 +11:00
2017-11-29 17:33:25 +11:00
2018-01-12 23:03:39 +11:00
2017-09-22 17:43:07 +08:00
2018-01-12 23:03:07 +11:00
2015-07-17 21:20:20 +08:00
2015-01-13 22:29:11 +11:00
2018-01-26 01:10:29 +11:00
2018-01-26 01:10:34 +11:00
2015-01-13 22:29:11 +11:00
2017-11-29 17:33:25 +11:00
2017-11-29 17:33:25 +11:00
2014-11-26 20:06:30 +08:00
2015-01-13 22:29:11 +11:00
2017-11-29 17:33:25 +11:00
2017-11-15 18:21:04 -08:00
2017-11-14 10:52:09 -08:00