mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2025-01-10 07:44:23 +08:00
ksmbd: not allow to open file if delelete on close bit is set
[ Upstream commit f43328357d
]
Cthon test fail with the following error.
check for proper open/unlink operation
nfsjunk files before unlink:
-rwxr-xr-x 1 root root 0 9월 25 11:03 ./nfs2y8Jm9
./nfs2y8Jm9 open; unlink ret = 0
nfsjunk files after unlink:
-rwxr-xr-x 1 root root 0 9월 25 11:03 ./nfs2y8Jm9
data compare ok
nfsjunk files after close:
ls: cannot access './nfs2y8Jm9': No such file or directory
special tests failed
Cthon expect to second unlink failure when file is already unlinked.
ksmbd can not allow to open file if flags of ksmbd inode is set with
S_DEL_ON_CLS flags.
Cc: stable@vger.kernel.org
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
d3dc26c4fd
commit
3898d8d685
@ -105,7 +105,7 @@ int ksmbd_query_inode_status(struct inode *inode)
|
||||
ci = __ksmbd_inode_lookup(inode);
|
||||
if (ci) {
|
||||
ret = KSMBD_INODE_STATUS_OK;
|
||||
if (ci->m_flags & S_DEL_PENDING)
|
||||
if (ci->m_flags & (S_DEL_PENDING | S_DEL_ON_CLS))
|
||||
ret = KSMBD_INODE_STATUS_PENDING_DELETE;
|
||||
atomic_dec(&ci->m_count);
|
||||
}
|
||||
@ -115,7 +115,7 @@ int ksmbd_query_inode_status(struct inode *inode)
|
||||
|
||||
bool ksmbd_inode_pending_delete(struct ksmbd_file *fp)
|
||||
{
|
||||
return (fp->f_ci->m_flags & S_DEL_PENDING);
|
||||
return (fp->f_ci->m_flags & (S_DEL_PENDING | S_DEL_ON_CLS));
|
||||
}
|
||||
|
||||
void ksmbd_set_inode_pending_delete(struct ksmbd_file *fp)
|
||||
|
Loading…
Reference in New Issue
Block a user