CVE-2022-49697

Source
https://nvd.nist.gov/vuln/detail/CVE-2022-49697
Import Source
https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2022-49697.json
JSON Data
https://api.test.osv.dev/v1/vulns/CVE-2022-49697
Downstream
Related
Published
2025-02-26T02:24:18.842Z
Modified
2025-11-28T02:34:20.304305Z
Summary
bpf: Fix request_sock leak in sk lookup helpers
Details

In the Linux kernel, the following vulnerability has been resolved:

bpf: Fix request_sock leak in sk lookup helpers

A customer reported a requestsocket leak in a Calico cloud environment. We found that a BPF program was doing a socket lookup with takes a refcnt on the socket and that it was finding the requestsocket but returning the parent LISTEN socket via sktofullsk() without decrementing the child request socket 1st, resulting in requestsock slab object leak. This patch retains the existing behaviour of returning full socks to the caller but it also decrements the child request_socket if one is present before doing so to prevent the leak.

Thanks to Curtis Taylor for all the help in diagnosing and testing this. And thanks to Antoine Tenart for the reproducer and patch input.

v2 of this patch contains, refactor as per Daniel Borkmann's suggestions to validate RCU flags on the listen socket so that it balances with bpfskrelease() and update comments as per Martin KaFai Lau's suggestion. One small change to Daniels suggestion, put "sk = sk2" under "if (sk2 != sk)" to avoid an extra instruction.

Database specific
{
    "cna_assigner": "Linux",
    "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/49xxx/CVE-2022-49697.json"
}
References

Affected packages

Git / git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git

Affected ranges

Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
edbf8c01de5a104a71ed6df2bf6421ceb2836a8e
Fixed
8ffe2e50e9678c8373027492035f094b130437f1
Fixed
516760f1d2979903eaad5b437256913c5cd98416
Fixed
b03607437ea81b850599f705096b05b85e7a4a71
Fixed
5a62b5ba4c0ce8315b6382cd4ace81b48cd121cd
Fixed
3046a827316c0e55fc563b4fb78c93b9ca5c7c37

Linux / Kernel

Package

Name
Kernel

Affected ranges

Type
ECOSYSTEM
Events
Introduced
5.2.0
Fixed
5.4.202
Type
ECOSYSTEM
Events
Introduced
5.5.0
Fixed
5.10.127
Type
ECOSYSTEM
Events
Introduced
5.11.0
Fixed
5.15.51
Type
ECOSYSTEM
Events
Introduced
5.16.0
Fixed
5.18.8