9p: avoid putting oldfid in p9_client_walk() error path
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ b48dbb998d70b7f48c2ec0a15c3cf47136808e4e · < 1a3860d46e3eb47dbd60339783cdad7904486b9f| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
9p: avoid putting oldfid in p9_client_walk() error path
When p9_client_walk() is called with clone set to false, fid aliases oldfid. If the walk subsequently fails after the request has been sent, the error path jumps to clunk_fid, which currently calls p9_fid_put(fid) unconditionally.
This drops a reference to oldfid even though ownership of oldfid remains with the caller. If this is the last reference, oldfid can be clunked and destroyed while the caller still expects it to be valid. A later use or put of oldfid can then trigger a use-after-free or refcount underflow.
Fix this by only putting fid in the clunk_fid error path when it does not alias oldfid, matching the existing guard in the error path below.
This can be triggered when a multi-component walk is split into multiple p9_client_walk() calls and a later non-cloning walk fails. A reproducer and refcount warning logs are available on request.
From the CVE record · Linux
The Linux kernel’s 9p client can incorrectly release a caller-owned fid when a non-cloning walk fails after its request is sent. If that was the last reference, later use can cause a use-after-free or refcount underflow. This can occur when a multi-component walk is split across calls and a later non-cloning walk fails; network access, authentication, and user-interaction requirements are not specified.
Engineers running Linux kernels with 9p support should check their systems; affected versions are not specified.