nfs: return EISDIR on nfs3_proc_create if d_alias is a dir
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
nfs: return EISDIR on nfs3_proc_create if d_alias is a dir
If we found an alias through nfs3_do_create/nfs_add_or_obtain /d_splice_alias which happens to be a dir dentry, we don't return any error, and simply forget about this alias, but the original dentry we were adding and passed as parameter remains negative.
This later causes an oops on nfs_atomic_open_v23/finish_open since we supply a negative dentry to do_dentry_open.
This has been observed running lustre-racer, where dirs and files are created/removed concurrently with the same name and O_EXCL is not used to open files (frequent file redirection).
While d_splice_alias typically returns a directory alias or NULL, we explicitly check d_is_dir() to ensure that we don't attempt to perform file operations (like finish_open) on a directory inode, which triggers the observed oops.
From the CVE record · Linux
The Linux kernel’s NFS file-creation path can mishandle a directory alias, leaving a negative dentry that causes an oops when a file is opened. This was observed when directories and files were concurrently created and removed with the same name, and files were opened without O_EXCL. The input does not specify attacker access requirements or other user interaction.
Engineers running Linux kernels with NFS should check whether their kernel includes the fix; affected versions are not specified.