linux/crypto/asymmetric_keys
Roman Smirnov 70fd1966c9 KEYS: prevent NULL pointer dereference in find_asymmetric_key()
In find_asymmetric_key(), if all NULLs are passed in the id_{0,1,2}
arguments, the kernel will first emit WARN but then have an oops
because id_2 gets dereferenced anyway.

Add the missing id_2 check and move WARN_ON() to the final else branch
to avoid duplicate NULL checks.

Found by Linux Verification Center (linuxtesting.org) with Svace static
analysis tool.

Cc: stable@vger.kernel.org # v5.17+
Fixes: 7d30198ee2 ("keys: X.509 public key issuer lookup without AKID")
Suggested-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Signed-off-by: Roman Smirnov <r.smirnov@omp.ru>
Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
2024-09-20 19:49:49 +03:00
..
asymmetric_keys.h
asymmetric_type.c KEYS: prevent NULL pointer dereference in find_asymmetric_key() 2024-09-20 19:49:49 +03:00
Kconfig certs: Add ECDSA signature verification self-test 2024-05-14 05:01:04 +03:00
Makefile certs: Add ECDSA signature verification self-test 2024-05-14 05:01:04 +03:00
mscode.asn1
mscode_parser.c Revert "crypto: pkcs7 - remove sha1 support" 2024-03-22 19:42:20 +08:00
pkcs7.asn1 treewide: Add SPDX identifier to IETF ASN.1 modules 2023-10-27 18:04:28 +08:00
pkcs7_key_type.c
pkcs7_parser.c crypto: sm2 - Remove sm2 algorithm 2024-06-07 19:46:39 +08:00
pkcs7_parser.h crypto: asymmetric_keys: fix some comments in pkcs7_parser.h 2021-01-21 16:16:09 +00:00
pkcs7_trust.c keys: X.509 public key issuer lookup without AKID 2022-01-09 00:18:42 +02:00
pkcs7_verify.c asymmetric_keys: log on fatal failures in PE/pkcs7 2023-03-21 16:23:56 +00:00
pkcs8.asn1 treewide: Add SPDX identifier to IETF ASN.1 modules 2023-10-27 18:04:28 +08:00
pkcs8_parser.c
public_key.c crypto: sm2 - Remove sm2 algorithm 2024-06-07 19:46:39 +08:00
restrict.c certs: Only allow certs signed by keys on the builtin keyring 2023-10-31 08:22:36 -04:00
selftest.c certs: Add ECDSA signature verification self-test 2024-05-14 05:01:04 +03:00
selftest.h certs: Add ECDSA signature verification self-test 2024-05-14 05:01:04 +03:00
selftest_ecdsa.c certs: Add ECDSA signature verification self-test 2024-05-14 05:01:04 +03:00
selftest_rsa.c certs: Move RSA self-test data to separate file 2024-05-14 05:01:03 +03:00
signature.c Revert "crypto: pkcs7 - remove sha1 support" 2024-03-22 19:42:20 +08:00
verify_pefile.c crypto: asymmetric_keys - remove redundant pointer secs 2024-01-26 16:39:32 +08:00
verify_pefile.h
x509.asn1 treewide: Add SPDX identifier to IETF ASN.1 modules 2023-10-27 18:04:28 +08:00
x509_akid.asn1 treewide: Add SPDX identifier to IETF ASN.1 modules 2023-10-27 18:04:28 +08:00
x509_cert_parser.c crypto: sm2 - Remove sm2 algorithm 2024-06-07 19:46:39 +08:00
x509_loader.c wifi: cfg80211: Deduplicate certificate loading 2023-01-19 14:46:45 +01:00
x509_parser.h X.509: Introduce scope-based x509_certificate allocation 2024-04-12 15:07:53 +08:00
x509_public_key.c crypto: sm2 - Remove sm2 algorithm 2024-06-07 19:46:39 +08:00