# CVE-2022-50046: net/sunrpc: fix potential memory leaks in rpc_sysfs_xprt_state_change()

- Severity: Medium 5.5 (CVSS:3.1, scored by NVD) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.27%, higher than 13% of CVEs (2026-11-30)
- Published: 2025-06-18T11:01:47.155Z
- Modified: 2026-06-17T05:22:38.057Z
- Weaknesses: CWE-401
- Assigned by: Linux

## Description

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

net/sunrpc: fix potential memory leaks in rpc_sysfs_xprt_state_change()

The issue happens on some error handling paths. When the function
fails to grab the object `xprt`, it simply returns 0, forgetting to
decrease the reference count of another object `xps`, which is
increased by rpc_sysfs_xprt_kobj_get_xprt_switch(), causing refcount
leaks. Also, the function forgets to check whether `xps` is valid
before using it, which may result in NULL-dereferencing issues.

Fix it by adding proper error handling code when either `xprt` or
`xps` is NULL.

(As written by CVE List.)

## Affected

- Linux Linux: from 5b7eb78486cd9ac58bfbd6d84ea0fe2d9fead03b before c0434f0e058648649250b8ed6078b66d773de723; from 5b7eb78486cd9ac58bfbd6d84ea0fe2d9fead03b before 76fbeb1662b1c56514325118a07fba74dc4c79fe; from 5b7eb78486cd9ac58bfbd6d84ea0fe2d9fead03b before bfc48f1b0505ffcb03a6d749139b7577d6b81ae0; 5.14 (not affected: before 5.14; from 5.15.63 up to 5.15.*; from 5.19.4 up to 5.19.*; from 6.0 up to *)
- linux linux_kernel: from 5.14 before 5.15.63; from 5.16 before 5.19.4; 6.0

## References

- <https://git.kernel.org/stable/c/c0434f0e058648649250b8ed6078b66d773de723> (patch)
- <https://git.kernel.org/stable/c/76fbeb1662b1c56514325118a07fba74dc4c79fe> (patch)
- <https://git.kernel.org/stable/c/bfc48f1b0505ffcb03a6d749139b7577d6b81ae0> (patch)

## Sources

- CVE List: [CVE-2022-50046](https://www.cve.org/CVERecord?id=CVE-2022-50046), CVE Terms of Use, modified 2026-05-11
- NVD: [CVE-2022-50046](https://nvd.nist.gov/vuln/detail/CVE-2022-50046), Public domain, modified 2026-06-17

---

Page: https://cve.day/CVE-2022-50046 · Whole record: https://cve.day/CVE-2022-50046.json · Rebuilt by cve.day 2026-11-25T22:58:21.027Z
