CVE-2023-52854
padata: Fix refcnt handling in padata_free_shell()
Reported by linux · Published May 21, 2024
In the Linux kernel, the following vulnerability has been resolved: padata: Fix refcnt handling in padata_free_shell() In a high-load arm64 environment, the pcrypt_aead01 test in LTP can lead to system UAF (Use-After-Free) issues. Due to the lengthy analysis of the pcrypt_aead01 function call, I'll describe the problem scenario using a simplified model: Suppose there's a user of padata named `user_function` that adheres to the padata requirement of calling `padata_free_shell` after `serial()` has been invoked, as demonstrated in the following code: ```c struct request { struct padata_priv padata; struct completion *done; }; void parallel(struct padata_priv *padata) { do_something(); } void serial(struct padata_priv *padata) { struct request *request = container_of(padata, struct request, padata); complete(request->done); } void user_function() { DECLARE_COMPLETION(done) padata->parallel = parallel; padata->serial = serial; padata_do_parallel(); wait_for_completion(&done); padata_free_shell(); } ``` In the corresponding padata.c file, there's the following code: ```c static void padata_serial_worker(struct work_struct *serial_work) { ... cnt = 0; while (!list_empty(&local_list)) { ... padata->serial(padata); cnt++; } local_bh_enable(); if (refcount_sub_and_test(cnt, &pd->refcnt)) padata_free_pd(pd); } ``` Because of the high system load and the accumulation of unexecuted softirq at this moment, `local_bh_enable()` in padata takes longer to execute than usual. Subsequently, when accessing `pd->refcnt`, `pd` has already been released by `padata_free_shell()`, resulting in a UAF issue with `pd->refcnt`. The fix is straightforward: add `refcount_dec_and_test` before calling `padata_free_pd` in `padata_free_shell`.
Fixed versions
Upgrade to a fixed version or later. Language registries are listed first, then Linux distributions, then vendor products.
| Package | Ecosystem | Fixed in |
|---|---|---|
| kernel-libbpf | Amazon Linux | 6.1.66-91.160.amzn2023 |
Affected products
| Vendor | Product | Versions |
|---|---|---|
| Linux | Linux | 07928d9bfc81640bab36f5190e8725894d93b659, 07928d9bfc81640bab36f5190e8725894d93b659, 07928d9bfc81640bab36f5190e8725894d93b659 |
| Linux | Linux | 5.6, 0, 5.10.201 |
| amazon:2023 | kernel-libbpf | 0 |
| Linux | Linux | 5.5.3, 07928d9bfc81640bab36f5190e8725894d93b659, 13721e447acc2b82c19cf72e9e6c4291c77693ed |
| amazon:2023 | kernel-modules-extra | 0 |
| amazon:2023 | kernel-livepatch-6.1.66-91.160 | 0 |
| amazon:2023 | kernel-tools | 0 |
| amazon:2023 | kernel | 0 |
| amazon:2023 | python3-perf | 0 |
| amazon:2023 | kernel-headers | 0 |
| amazon:2023 | kernel-tools-devel | 0 |
| amazon:2023 | perf | 0 |
| amazon:2023 | kernel-libbpf-devel | 0 |
| amazon:2023 | kernel-libbpf-static | 0 |
| linux | linux_kernel | 5.6, 5.6, 5.6 |
| amazon:2023 | bpftool | 0 |
| amazon:2023 | kernel-devel | 0 |
Timeline
- May 21, 2024 CVE Published
- May 22, 2024 EPSS Score (30 in total, the first dated here)
- Oct 5, 2024 Coalition ESS Score (6 in total, the first dated here)
- Dec 5, 2025 CVE Updated
- Jan 14, 2026 PoC Published
- Jan 25, 2026 Security Advisory (298 in total, the first dated here)
- Apr 20, 2026 Distribution Patch (204 in total, the first dated here)
Query this with the API
The same record, from the CLI:
vulnetix vdb vuln CVE-2023-52854
vulnetix vdb fixes CVE-2023-52854
Or with curl, using the org id and key from your account page:
curl -s -H "Authorization: ApiKey ${VULNETIX_ORG_ID}:${VULNETIX_API_KEY}" \
"https://api.vdb.vulnetix.com/v2/vuln/CVE-2023-52854/fixes/registry"
The Community plan is free and allows 50 queries a day. Get a free API key · API quickstart