sst-linux/crypto/asymmetric_keys
Roman Smirnov 3322fa8f2a KEYS: prevent NULL pointer dereference in find_asymmetric_key()
commit 70fd1966c93bf3bfe3fe6d753eb3d83a76597eef upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-10-17 15:21:17 +02:00
..
asymmetric_keys.h
asymmetric_type.c KEYS: prevent NULL pointer dereference in find_asymmetric_key() 2024-10-17 15:21:17 +02:00
Kconfig KEYS: asymmetric: Add missing dependencies of FIPS_SIGNATURE_SELFTEST 2024-06-12 11:02:58 +02:00
Makefile
mscode_parser.c
mscode.asn1
pkcs7_key_type.c
pkcs7_parser.c
pkcs7_parser.h
pkcs7_trust.c
pkcs7_verify.c
pkcs7.asn1
pkcs8_parser.c
pkcs8.asn1
public_key.c KEYS: asymmetric: Copy sig and digest in public_key_verify_signature() 2023-06-09 10:34:28 +02:00
restrict.c
selftest.c
signature.c
verify_pefile.c
verify_pefile.h
x509_akid.asn1
x509_cert_parser.c
x509_loader.c
x509_parser.h
x509_public_key.c X.509: if signature is unsupported skip validation 2023-09-13 09:43:03 +02:00
x509.asn1