|WARNING| [v2, 2/2] crypto/openssl: load default provider first legacy optional
dpdklab at iol.unh.edu
dpdklab at iol.unh.edu
Thu Nov 26 10:13:58 CET 2026
Test-Label: ai-code-review
Test-Status: WARNING
https://dpdk.org/patch/173201
_AI Code Review_
=== Patch Review: series.patch (via Claude) ===
Review date: 2026-11-26
**Patch 2/2: crypto/openssl: load default provider first legacy optional**
**Error: the load-failure path unloads a stale `legacy` provider pointer.**
```c
if (ossl_providers_load() < 0) {
ossl_providers_unload();
return -ENOTSUP;
}
```
`ossl_providers_load()` fails only when the default provider load fails, and it returns before touching `legacy`. At that point `deflt` is NULL, but `legacy` is a global that still holds whatever an earlier `cryptodev_openssl_create()` stored in it. `ossl_providers_unload()` then calls `OSSL_PROVIDER_unload(legacy)`:
- If another openssl vdev is still alive, this drops a reference that device owns.
- If that device was already removed, it unloads a handle that was already unloaded.
The neighbouring hunks never reset `legacy` or `deflt` to NULL after an unload, so the stale value survives.
Suggested fix:
- Nothing is loaded when `ossl_providers_load()` fails, so drop the `ossl_providers_unload()` call on this path and just `return -ENOTSUP`.
- In `ossl_providers_unload()`, set `legacy = NULL;` and `deflt = NULL;` after unloading. A later call then becomes a no-op (`OSSL_PROVIDER_unload(NULL)` is safe).
**Warning: `init_error` unloads providers unconditionally after `cryptodev_openssl_remove()`.**
```c
cryptodev_openssl_remove(vdev);
ossl_providers_unload();
```
By the commit message's own description, `cryptodev_openssl_remove()` already calls `ossl_providers_unload()` whenever it finds the device. The extra unload is only correct when `remove` returns `-ENODEV`. Any `goto init_error` taken after `rte_cryptodev_pmd_create()` succeeded would unload both providers twice.
Make the unload depend on the return value:
```c
if (cryptodev_openssl_remove(vdev) == -ENODEV)
ossl_providers_unload();
```
Combined with resetting the pointers to NULL as above, this keeps load and unload balanced on every path.
**Info: pre-existing global names without a driver prefix.**
`OSSL_PROVIDER *legacy;` and `OSSL_PROVIDER *deflt;` are non-static globals with generic names. This is not introduced by this patch, but the rework is a good moment to make them `static` or give them an `openssl_` prefix to avoid static-link symbol clashes.
**Patch 1/2: crypto/openssl: filter legacy ciphers from capability list**
**Info: commit message does not match the code.**
- The message says "Log a warning when DES algorithms are unavailable", but `openssl_pmd_caps_init()` filters silently without logging.
- The v2 changelog says the `openssl_pmd_caps_init()` call moved to patch 2, yet this patch still adds the call after `ossl_legacy_provider_load()`.
Either add the warning in `openssl_pmd_caps_init()` when the DES entries are skipped, or update the text.
Review-Result: ERROR
More information about the test-report
mailing list