io_uring: fix filename leak in __io_openat_prep()
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ b9445598d8c60a1379887b957024b71343965f74 · < b14fad555302a2104948feaff70503b64c80ac01| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
io_uring: fix filename leak in __io_openat_prep()
__io_openat_prep() allocates a struct filename using getname(). However, for the condition of the file being installed in the fixed file table as well as having O_CLOEXEC flag set, the function returns early. At that point, the request doesn't have REQ_F_NEED_CLEANUP flag set. Due to this, the memory for the newly allocated struct filename is not cleaned up, causing a memory leak.
Fix this by setting the REQ_F_NEED_CLEANUP for the request just after the successful getname() call, so that when the request is torn down, the filename will be cleaned up, along with other resources needing cleanup.
From the CVE record · Linux
The Linux kernel's io_uring file-open preparation can leak memory allocated for a filename. This occurs when an io_uring open request installs a file in the fixed file table with O_CLOEXEC set. The input does not specify authentication or user-interaction requirements.
Teams running Linux kernels with the affected io_uring code should check their kernel versions against the vendor advisory; affected versions are not specified.