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_parser.c Revert "crypto: pkcs7 - remove sha1 support" 2024-03-22 19:42:20 +08:00
mscode.asn1
pkcs7_key_type.c
pkcs7_parser.c crypto: sm2 - Remove sm2 algorithm 2024-06-07 19:46:39 +08:00
pkcs7_parser.h
pkcs7_trust.c
pkcs7_verify.c
pkcs7.asn1
pkcs8_parser.c
pkcs8.asn1
public_key.c crypto: sm2 - Remove sm2 algorithm 2024-06-07 19:46:39 +08:00
restrict.c
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
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
signature.c Revert "crypto: pkcs7 - remove sha1 support" 2024-03-22 19:42:20 +08:00
verify_pefile.c
verify_pefile.h
x509_akid.asn1
x509_cert_parser.c crypto: sm2 - Remove sm2 algorithm 2024-06-07 19:46:39 +08:00
x509_loader.c
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
x509.asn1