|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:10:40 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: double `OSSL_PROVIDER_unload()` on the `init_error` path once the device exists**
Added line in `init_error`:
```
cryptodev_openssl_remove(vdev);
+ ossl_providers_unload();
```
`cryptodev_openssl_remove()` already calls `ossl_providers_unload()` whenever it finds the device:
```
+ ossl_providers_unload();
return rte_cryptodev_pmd_destroy(cryptodev);
```
`ossl_providers_unload()` does not clear the `legacy` and `deflt` globals after unloading them.
So if `init_error` is reached after `rte_cryptodev_pmd_create()` has succeeded, both providers are unloaded twice. That drops a reference that is not held, which is a use-after-free or double-free in OpenSSL.
The extra call is only safe when `remove()` returns `-ENODEV`. Fix it in one of two ways:
- Clear the globals inside `ossl_providers_unload()`:
```c
OSSL_PROVIDER_unload(legacy);
legacy = NULL;
OSSL_PROVIDER_unload(deflt);
deflt = NULL;
```
- Or call `ossl_providers_unload()` only when `cryptodev_openssl_remove()` returns `-ENODEV`.
**Error: provider-load failure path unloads a stale `legacy` handle**
```
+ if (ossl_providers_load() < 0) {
+ ossl_providers_unload();
+ return -ENOTSUP;
+ }
```
`ossl_providers_load()` returns before it assigns `legacy`. The unload therefore operates on whatever `legacy` already holds.
With more than one openssl vdev instance, that is the handle loaded by an earlier, still-active instance. Unloading it breaks DES for that device.
`deflt` is NULL at this point, so nothing in this function needs unloading. Drop the `ossl_providers_unload()` call here, or have `ossl_providers_load()` work only on locals and assign the globals on success.
**Warning: bug fix lacks `Fixes:` and `Cc: stable at dpdk.org`**
The commit fixes a regression: a failed legacy load leaves no active provider, so AES, SHA and MD5 stop working. It should carry a `Fixes:` tag for the commit that introduced the legacy-first load, plus `Cc: stable at dpdk.org`.
**Info: per-instance loads into shared globals (pre-existing)**
Provider handles are stored in the file-scope globals `legacy` and `deflt`. Each `cryptodev_openssl_create()` overwrites them, so earlier instances' references are leaked, and the first `remove()` unloads the handles of the most recent instance.
This is pre-existing and not introduced by this patch. A reference count or one-time load would make the load/unload pairing robust.
**Patch 1/2: crypto/openssl: filter legacy ciphers from capability list**
**Info: commit message does not match the code**
The commit message says "Log a warning when DES algorithms are unavailable". `openssl_pmd_caps_init()` silently skips the entries:
```
+ if (des_cbc == NULL)
+ continue;
```
Either add the log or drop the sentence.
Review-Result: ERROR
More information about the test-report
mailing list