ghsa-wxgf-7f8j-hr6j
Vulnerability from github
In the Linux kernel, the following vulnerability has been resolved:
capabilities: fix potential memleak on error path from vfs_getxattr_alloc()
In cap_inode_getsecurity(), we will use vfs_getxattr_alloc() to complete the memory allocation of tmpbuf, if we have completed the memory allocation of tmpbuf, but failed to call handler->get(...), there will be a memleak in below logic:
|-- ret = (int)vfs_getxattr_alloc(mnt_userns, ...) | / ^^^ alloc for tmpbuf / |-- value = krealloc(xattr_value, error + 1, flags) | / ^^^ alloc memory / |-- error = handler->get(handler, ...) | / error! / |-- xattr_value = value | / xattr_value is &tmpbuf (memory leak!) /
So we will try to free(tmpbuf) after vfs_getxattr_alloc() fails to fix it.
[PM: subject line and backtrace tweaks]
{ "affected": [], "aliases": [ "CVE-2022-49890" ], "database_specific": { "cwe_ids": [], "github_reviewed": false, "github_reviewed_at": null, "nvd_published_at": "2025-05-01T15:16:14Z", "severity": null }, "details": "In the Linux kernel, the following vulnerability has been resolved:\n\ncapabilities: fix potential memleak on error path from vfs_getxattr_alloc()\n\nIn cap_inode_getsecurity(), we will use vfs_getxattr_alloc() to\ncomplete the memory allocation of tmpbuf, if we have completed\nthe memory allocation of tmpbuf, but failed to call handler-\u003eget(...),\nthere will be a memleak in below logic:\n\n |-- ret = (int)vfs_getxattr_alloc(mnt_userns, ...)\n | /* ^^^ alloc for tmpbuf */\n |-- value = krealloc(*xattr_value, error + 1, flags)\n | /* ^^^ alloc memory */\n |-- error = handler-\u003eget(handler, ...)\n | /* error! */\n |-- *xattr_value = value\n | /* xattr_value is \u0026tmpbuf (memory leak!) */\n\nSo we will try to free(tmpbuf) after vfs_getxattr_alloc() fails to fix it.\n\n[PM: subject line and backtrace tweaks]", "id": "GHSA-wxgf-7f8j-hr6j", "modified": "2025-05-01T15:31:51Z", "published": "2025-05-01T15:31:51Z", "references": [ { "type": "ADVISORY", "url": "https://nvd.nist.gov/vuln/detail/CVE-2022-49890" }, { "type": "WEB", "url": "https://git.kernel.org/stable/c/0c3e6288da650d1ec911a259c77bc2d88e498603" }, { "type": "WEB", "url": "https://git.kernel.org/stable/c/2de8eec8afb75792440b8900a01d52b8f6742fd1" }, { "type": "WEB", "url": "https://git.kernel.org/stable/c/6bb00eb21c0fbf18e5d3538c9ff0cf63fd0ace85" }, { "type": "WEB", "url": "https://git.kernel.org/stable/c/7480aeff0093d8c54377553ec6b31110bea37b4d" }, { "type": "WEB", "url": "https://git.kernel.org/stable/c/8cf0a1bc12870d148ae830a4ba88cfdf0e879cee" }, { "type": "WEB", "url": "https://git.kernel.org/stable/c/90577bcc01c4188416a47269f8433f70502abe98" }, { "type": "WEB", "url": "https://git.kernel.org/stable/c/cdf01c807e974048c43c7fd3ca574f6086a57906" } ], "schema_version": "1.4.0", "severity": [] }
- Seen: The vulnerability was mentioned, discussed, or seen somewhere by the user.
- Confirmed: The vulnerability is confirmed from an analyst perspective.
- Exploited: This vulnerability was exploited and seen by the user reporting the sighting.
- Patched: This vulnerability was successfully patched by the user reporting the sighting.
- Not exploited: This vulnerability was not exploited or seen by the user reporting the sighting.
- Not confirmed: The user expresses doubt about the veracity of the vulnerability.
- Not patched: This vulnerability was not successfully patched by the user reporting the sighting.