Commit f4da8dcc authored by Trond Myklebust's avatar Trond Myklebust Committed by Yang Yingliang
Browse files

NFSv4: Handle case where the lookup of a directory fails



mainline inclusion
from mainline-v5.16
commit ac795161
category: bugfix
bugzilla: 186205
CVE: CVE-2022-24448

-----------------------------------------------

If the application sets the O_DIRECTORY flag, and tries to open a
regular file, nfs_atomic_open() will punt to doing a regular lookup.
If the server then returns a regular file, we will happily return a
file descriptor with uninitialised open state.

The fix is to return the expected ENOTDIR error in these cases.

Reported-by: default avatarLyu Tao <tao.lyu@epfl.ch>
Fixes: 0dd2b474 ("nfs: implement i_op->atomic_open()")
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: default avatarAnna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: default avatarZhang Xiaoxu <zhangxiaoxu5@huawei.com>
Reviewed-by: default avatarZhang Yi <yi.zhang@huawei.com>
Reviewed-by: default avatarXiu Jianfeng <xiujianfeng@huawei.com>
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
parent b0c06baf
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment